[Pkg-javascript-commits] [node-deps-sort] 25/79: dedupe index test

Bastien Roucariès rouca at moszumanska.debian.org
Wed Sep 6 09:41:54 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 7df253f6d9fdca320f429d4f8ee4a8df17432c4c
Author: James Halliday <mail at substack.net>
Date:   Mon Jul 21 07:01:49 2014 -0700

    dedupe index test
---
 test/dedupe_index.js | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/test/dedupe_index.js b/test/dedupe_index.js
new file mode 100644
index 0000000..cb40393
--- /dev/null
+++ b/test/dedupe_index.js
@@ -0,0 +1,35 @@
+var sort = require('../');
+var test = require('tape');
+var through = require('through2');
+
+test('dedupe index', function (t) {
+    t.plan(1);
+    var s = sort({ dedupe: true, index: true });
+    var rows = [];
+    function write (row, enc, next) { rows.push(row); next() }
+    function end () {
+        t.deepEqual(rows, [
+            { id: 1, deps: {}, source: 'TWO', dedupe: 1 },
+            { id: 2, deps: {}, source: 'TWO', dedupe: 1 },
+            { id: 3, deps: { './foo': 1, './bar': 2 }, source: 'ONE' }
+        ]);
+    }
+    s.pipe(through.obj(write, end));
+    
+    s.write({
+        id: '/main.js',
+        deps: { './foo': '/foo.js', './bar': '/bar.js' },
+        source: 'ONE'
+    });
+    s.write({
+        id: '/foo.js',
+        deps: {},
+        source: 'TWO'
+    });
+    s.write({
+        id: '/bar.js',
+        deps: {},
+        source: 'TWO'
+    });
+    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