1 | var sort = require('../');
|
2 | var test = require('tape');
|
3 | var through = require('through2');
|
4 |
|
5 | test('expose true', function (t) {
|
6 | t.plan(1);
|
7 | var s = sort({ index: true, expose: [ '/foo.js', '/bar.js' ] });
|
8 | var rows = [];
|
9 | function write (row, enc, next) { rows.push(row); next() }
|
10 | function end () {
|
11 | t.deepEqual(rows, [
|
12 | {
|
13 | id: '/bar.js',
|
14 | deps: {},
|
15 | index: '/bar.js',
|
16 | indexDeps: {}
|
17 | },
|
18 | {
|
19 | id: '/foo.js',
|
20 | deps: { './bar': '/bar.js' },
|
21 | index: '/foo.js',
|
22 | indexDeps: { './bar': '/bar.js' }
|
23 | },
|
24 | {
|
25 | id: '/main.js',
|
26 | deps: { './foo': '/foo.js' },
|
27 | index: 1,
|
28 | indexDeps: { './foo': '/foo.js' }
|
29 | },
|
30 | ]);
|
31 | }
|
32 | s.pipe(through.obj(write, end));
|
33 |
|
34 | s.write({ id: '/main.js', deps: { './foo': '/foo.js' } });
|
35 | s.write({ id: '/foo.js', deps: { './bar': '/bar.js' } });
|
36 | s.write({ id: '/bar.js', deps: {} });
|
37 | s.end();
|
38 | });
|