From d3fcd4ae9e57d6e8ea490ab31d3fa8542d05a61a Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Wed, 27 May 2015 11:35:28 -0400 Subject: [PATCH] Add tests * Add shallow test case * Add polyglot test case --- test/streams/polyglot.js | 17 +++++++++++++++++ test/streams/shallow.js | 26 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 test/streams/polyglot.js create mode 100644 test/streams/shallow.js diff --git a/test/streams/polyglot.js b/test/streams/polyglot.js new file mode 100644 index 0000000..82aa8e0 --- /dev/null +++ b/test/streams/polyglot.js @@ -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(); + })); +}); diff --git a/test/streams/shallow.js b/test/streams/shallow.js new file mode 100644 index 0000000..a2ccdec --- /dev/null +++ b/test/streams/shallow.js @@ -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(); + })); +});