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

Bastien Roucariès rouca at moszumanska.debian.org
Wed Sep 6 09:41:53 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 3509c845f61330e117d198e2bd973129c6466f69
Author: James Halliday <mail at substack.net>
Date:   Mon Jul 21 06:51:23 2014 -0700

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

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