{"size": 1116, "ext": "js", "max_stars_repo_path": "packages/moysklad-tools/lib/__tests__/getId.test.js", "max_stars_repo_name": "wmakeev/moysklad-tools", "max_stars_repo_stars_event_min_datetime": "2017-06-19T05:51:19.000Z", "max_stars_repo_stars_event_max_datetime": "2018-03-01T08:44:48.000Z", "max_issues_repo_path": "packages/moysklad-tools/lib/__tests__/getId.test.js", "max_issues_repo_name": "wmakeev/moysklad-tools", "max_issues_repo_issues_event_min_datetime": "2017-12-03T14:30:25.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-06T19:36:23.000Z", "max_forks_repo_path": "packages/moysklad-tools/lib/__tests__/getId.test.js", "max_forks_repo_name": "wmakeev/moysklad-tools", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": 5, "max_forks_count": null, "avg_line_length": 33.8181818182, "max_line_length": 277, "alphanum_fraction": 0.6693548387}
'use strict';

const test = require('blue-tape');

var _require = require('..');

const getId = _require.getId;


test('tools.getId', t => {
  t.equals(typeof getId, 'function', 'should be function');

  const TEST_ID = '18fba15b-9288-11e9-9109-f8fc00117bb7';

  const VALID = ['entity/foo/18fba15b-9288-11e9-9109-f8fc00117bb7', 'entity/foo/18fba15b-9288-11e9-9109-f8fc00117bb7/', 'https://path/to/some/18fba15b-9288-11e9-9109-f8fc00117bb7', 'https://path/to/some/18fba15b-9288-11e9-9109-f8fc00117bb7?some=query', {
    meta: {
      type: 'foo',
      href: 'https://path/to/some/18fba15b-9288-11e9-9109-f8fc00117bb7'
    }
  }];

  for (let it of VALID) {
    t.equal(getId(it), TEST_ID, `should return id for ${it}`);
  }

  const INVALID = ['entity/foo/18fba15b-9288-11e9-9109-f8fc001*17bb7', 'entity/foo/18fba15b-9288-11e9-9109-f8fc0017bb7/', 'http://path/to/some/18fba15b-9288-11e9-9109-f8fc00117bb7', 'path/to/some/18fba15b-9288-11e9-9109-f8fc00117bb7?some=query', {}, { meta: { href: 'foo' } }];

  for (let it of INVALID) {
    t.equal(getId(it), null, `should not return id for ${it}`);
  }

  t.end();
});