-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.js
More file actions
46 lines (43 loc) · 1.7 KB
/
test.js
File metadata and controls
46 lines (43 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict';
var assert = require('assert');
var path = require('path');
var jsb3 = require('./index');
it('should read all files from jsb3 stream', function(cb){
jsb3('testfiles/file1.jsb3').then(function(files){
assert.equal(files.length, 2);
assert.strictEqual('folder1', path.dirname(files[0]));
assert.strictEqual('file.txt', path.basename(files[0]));
assert.strictEqual('folder2', path.dirname(files[1]));
assert.strictEqual('file.pdf', path.basename(files[1]));
cb();
}).catch(function(message){
assert(false, message);
cb();
});
});
it('should read all files from jsb3 stream with multiple projects', function(cb){
jsb3('testfiles/file2.jsb3').then(function(files){
assert.equal(files.length, 2);
assert.strictEqual('folder1', path.dirname(files[0]));
assert.strictEqual('file.txt', path.basename(files[0]));
assert.strictEqual('folder2', path.dirname(files[1]));
assert.strictEqual('file.pdf', path.basename(files[1]));
cb();
}).catch(function(message){
assert(false, message);
cb();
});
});
it('should read all files from jsb3 with trailing comma (bug compatible)', function(cb){
jsb3('testfiles/file3.jsb3').then(function(files){
assert.equal(files.length, 2);
assert.strictEqual('folder1', path.dirname(files[0]));
assert.strictEqual('file.txt', path.basename(files[0]));
assert.strictEqual('folder2', path.dirname(files[1]));
assert.strictEqual('file.pdf', path.basename(files[1]));
cb();
}).catch(function(message){
assert(false, message);
cb();
});
});