{"size": 1095, "ext": "js", "max_stars_repo_path": "test.js", "max_stars_repo_name": "iamstarkov/domain-links", "max_stars_repo_stars_event_min_datetime": "2015-11-17T00:28:24.000Z", "max_stars_repo_stars_event_max_datetime": "2015-11-17T00:28:24.000Z", "max_issues_repo_path": "test.js", "max_issues_repo_name": "iamstarkov/domain-links", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test.js", "max_forks_repo_name": "iamstarkov/domain-links", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.3333333333, "max_line_length": 46, "alphanum_fraction": 0.5205479452}
import { deepEqual } from 'assert';
import domainLinks from './index';

const links = [
  'http://what.ever/a/',
  'http://what.ever/b/',
  'http://www.what.ever/c/',
  'http://foo.bar/1/',
  'http://www.foo.bar/1/',
  'http://foo.bar/2/',
  'http://foo.bar/3/',
  'http://www.baz.com/boo/'
];

it('should domainLinks', () =>
  deepEqual(domainLinks(links), [
    { domain: 'what.ever',
      links: [
        'http://what.ever/a/',
        'http://what.ever/b/',
        'http://what.ever/c/' ]},
    { domain: 'foo.bar',
      links: [
        'http://foo.bar/1/',
        'http://foo.bar/2/',
        'http://foo.bar/3/' ]},
    { domain: 'www.baz.com',
      links: [
        'http://www.baz.com/boo/' ]}
  ]));

it('should handle nested domains links', () =>
  deepEqual(domainLinks([
    'http://carsales.com.au/',
    'http://seek.com.au/'
  ]), [
    { domain: 'carsales.com.au',
      links: [ 'http://carsales.com.au/' ]},
    { domain: 'seek.com.au',
      links: [ 'http://seek.com.au/' ]}
  ]));

it('should domainLinks invalid input', () =>
  deepEqual(domainLinks(), undefined));
