Add tests

* Add shallow test case
* Add polyglot test case
This commit is contained in:
Tom MacWright 2015-05-27 11:35:28 -04:00
parent 9f3bc54ce0
commit d3fcd4ae9e
2 changed files with 43 additions and 0 deletions

17
test/streams/polyglot.js Normal file
View File

@ -0,0 +1,17 @@
'use strict';
var test = require('prova'),
concat = require('concat-stream'),
path = require('path'),
shallow = require('../../streams/shallow'),
polyglot = require('../../streams/polyglot');
test('polyglot', function (t) {
shallow([path.resolve(path.join(__dirname, '../fixture/polyglot/blend.cpp'))])
.pipe(polyglot())
.pipe(concat(function (comments) {
t.equal(comments.length, 1);
t.equal(comments[0].description, 'This method moves a hex to a color');
t.end();
}));
});

26
test/streams/shallow.js Normal file
View File

@ -0,0 +1,26 @@
'use strict';
var test = require('prova'),
concat = require('concat-stream'),
path = require('path'),
shallow = require('../../streams/shallow');
test('shallow deps', function (t) {
shallow([path.resolve(path.join(__dirname, '../fixture/es6.input.js'))])
.pipe(concat(function (deps) {
t.equal(deps.length, 1);
t.ok(deps[0].file, 'has file');
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'))
]).pipe(concat(function (deps) {
t.equal(deps.length, 2);
t.ok(deps[0].file, 'has file');
t.end();
}));
});