{"size": 905, "ext": "js", "max_stars_repo_path": "node_modules/grunt-contrib-watch/node_modules/tiny-lr/node_modules/noptify/test/collectable.js", "max_stars_repo_name": "DeinDesign/css", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "node_modules/grunt-contrib-watch/node_modules/tiny-lr/node_modules/noptify/test/collectable.js", "max_issues_repo_name": "DeinDesign/css", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "node_modules/grunt-contrib-watch/node_modules/tiny-lr/node_modules/noptify/test/collectable.js", "max_forks_repo_name": "DeinDesign/css", "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": 23.2051282051, "max_line_length": 80, "alphanum_fraction": 0.5712707182}
var noptify = require('..');
var assert = require('assert');

describe('Collectable', function () {

  it('provides the helper method to read from stdin', function () {
    var program = noptify();
    assert.ok(typeof program.stdin === 'function', 'stdin defined');
  });

  it('is invoked only when .parse() is called', function (done) {
    var program = noptify(['', '']);
    var str = 'testing out stdin helper';
    program.stdin(function (err, res) {
      assert.equal(res, str);
      done();
    });

    program.parse();

    process.nextTick(function () {
      process.stdin.emit('data', str);
      process.stdin.emit('end');
    });
  });

  it('.files()', function (done) {
    var program = noptify(['', '', 'test/fixtures/a.js', 'test/fixtures/b.js']);
    program.parse();

    program.files(function (err, data) {
      assert.equal(data, 'a\nb\n');
      done();
    });

  });

});
