{"size": 953, "ext": "js", "max_stars_repo_path": "test/reader.js", "max_stars_repo_name": "koding/bant", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/reader.js", "max_issues_repo_name": "koding/bant", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/reader.js", "max_forks_repo_name": "koding/bant", "max_forks_repo_forks_event_min_datetime": "2016-07-21T21:00:13.000Z", "max_forks_repo_forks_event_max_datetime": "2020-12-24T10:14:17.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 26.4722222222, "max_line_length": 72, "alphanum_fraction": 0.5750262329}
var Reader = require('../lib/reader');
var Readable = require('stream').Readable;
var test = require('tape');
var concat = require('concat-stream');

test('reader', function (t) {
  t.plan(5);
  var reader = new Reader();
  reader.queue(rs());
  reader.queue(__dirname + '/read-manifests/y.json');
  reader.queue({ name: 'z', main: __dirname + '/read-manifests/z.js' });
  reader.on('end', function (res) {
    t.equal(res.length, 3);
    res = res.reduce(function (acc, x) {
      acc[x.name] = x;
      return acc;
    }, {});
    t.equal(res.z.expose, 'z');
    t.equal(res.y.main, __dirname + '/read-manifests/y.js');
    t.equal(res.x.name, 'x');
    t.ok(res.x._entry && 'function' === typeof res.x._entry.pipe);
  });
  reader.end();
});

function rs () {
  var s = Readable({ objectMode: true });
  s._read = function () {
    s.push({ 
      name: 'x',
      main: __dirname + '/read-manifests/x.js'
    });
    s.push(null);
  };
  return s;
}