This repository has been archived by the owner on Jan 13, 2018. It is now read-only.
/
util-test.js
52 lines (47 loc) · 1.59 KB
/
util-test.js
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
47
48
49
50
51
52
var vows = require('vows'),
assert = require('assert'),
bemUtil = require('../lib/util');
vows.describe('util').addBatch({
'getBemTechPath() call with param': {
topic: function() {
return bemUtil.getBemTechPath;
},
"'css' resolves to 'bem/lib/techs/css'": function(topic) {
assert.equal(topic('css'), 'bem/lib/techs/css');
},
"'custom' resolves to 'bem/lib/techs/default'": function(topic) {
assert.equal(topic('custom'), 'bem/lib/techs/default');
}
},
'isRequireable() call with param': {
topic: function() {
return bemUtil.isRequireable;
},
"'path' returns true": function(topic) {
assert.isTrue(topic('path'));
},
"'unexistent-module' returns false": function(topic) {
assert.isFalse(topic('unexistent-module'));
}
},
'isPath() call with param': {
topic: function() {
return bemUtil.isPath;
},
"'/path/to/file' returns true": function(topic) {
assert.isTrue(topic('/path/to/file'));
},
"'./path/to/file' returns true": function(topic) {
assert.isTrue(topic('./path/to/file'));
},
"'path/to/file' returns true": function(topic) {
assert.isTrue(topic('path/to/file'));
},
"'file' returns false": function(topic) {
assert.isFalse(topic('file'));
},
"'file.ext' returns false": function(topic) {
assert.isFalse(topic('file.ext'));
}
}
}).export(module);