[Pkg-javascript-commits] [node-deps-sort] 17/79: tests for expose

Bastien Roucariès rouca at moszumanska.debian.org
Wed Sep 6 09:41:52 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-deps-sort.

commit d4e28114f160d3fe975a667243062284b2d0d264
Author: James Halliday <mail at substack.net>
Date:   Mon Jul 21 05:04:23 2014 -0700

    tests for expose
---
 test/expose.js | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/test/expose.js b/test/expose.js
new file mode 100644
index 0000000..1d29728
--- /dev/null
+++ b/test/expose.js
@@ -0,0 +1,38 @@
+var sort = require('../');
+var test = require('tape');
+var through = require('through2');
+
+test('expose', function (t) {
+    t.plan(1);
+    var s = sort({ index: true, expose: [ '/foo.js', '/bar.js' ] });
+    var rows = [];
+    function write (row, enc, next) { rows.push(row); next() }
+    function end () {
+        t.deepEqual(rows, [
+            {
+                id: '/bar.js',
+                deps: {},
+                index: '/bar.js',
+                indexDeps: {}
+            },
+            {
+                id: '/foo.js',
+                deps: { './bar': '/bar.js' },
+                index: '/foo.js',
+                indexDeps: { './bar': '/bar.js' }
+            },
+            {
+                id: '/main.js',
+                deps: { './foo': '/foo.js' },
+                index: 1,
+                indexDeps: { './foo': '/foo.js' }
+            },
+        ]);
+    }
+    s.pipe(through.obj(write, end));
+    
+    s.write({ id: '/main.js', deps: { './foo': '/foo.js' } });
+    s.write({ id: '/foo.js', deps: { './bar': '/bar.js' } });
+    s.write({ id: '/bar.js', deps: {} });
+    s.end();
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-deps-sort.git



More information about the Pkg-javascript-commits mailing list