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

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 4ac4c4ceef9ce3392f223390ca0777ecba258c96
Author: James Halliday <mail at substack.net>
Date:   Sun Jul 20 06:23:45 2014 -0700

    sort test
---
 test/sort.js | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

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