{"size": 1370, "ext": "js", "max_stars_repo_path": "test/lib/input/shallow.js", "max_stars_repo_name": "gkovacs/documentation-habitlab", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/lib/input/shallow.js", "max_issues_repo_name": "gkovacs/documentation-habitlab", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/lib/input/shallow.js", "max_forks_repo_name": "gkovacs/documentation-habitlab", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.8333333333, "max_line_length": 79, "alphanum_fraction": 0.5423357664}
'use strict';

var test = require('tap').test,
  path = require('path'),
  shallow = require('../../../lib/input/shallow');

test('shallow deps', function(t) {
  shallow([path.resolve(path.join(__dirname, '../../fixture/es6.input.js'))], {
  }).then(deps => {
    t.equal(deps.length, 1);
    t.ok(deps[0], 'has path');
    t.end();
  });
});

test('shallow deps multi', function(t) {
  shallow(
    [
      path.resolve(path.join(__dirname, '../../fixture/es6.input.js')),
      path.resolve(path.join(__dirname, '../../fixture/es6.output.json'))
    ],
    {}
  ).then(deps => {
    t.equal(deps.length, 2);
    t.ok(deps[0], 'has path');
    t.end();
  });
});

test('shallow deps directory', function(t) {
  shallow([path.resolve(path.join(__dirname, '../../fixture/html'))], {})
    .then(deps => {
      t.equal(deps.length, 1);
      t.ok(deps[0].file.match(/input.js/), 'is the input file');
      t.end();
    })
    .catch(err => {
      t.fail(err);
      t.end();
    });
});

test('throws on non-string or object input', function(t) {
  shallow([true], {}).catch(err => {
    t.equal(err.message, 'Indexes should be either strings or objects');
    t.end();
  });
});

test('shallow deps literal', function(t) {
  var obj = {
    file: 'foo.js',
    source: '//bar'
  };
  shallow([obj], {}).then(deps => {
    t.equal(deps[0], obj);
    t.end();
  });
});
