This repository has been archived by the owner on Jan 13, 2018. It is now read-only.
/
tech-test.js
61 lines (56 loc) · 2.36 KB
/
tech-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
53
54
55
56
57
58
59
60
61
var vows = require('vows'),
assert = require('assert'),
Tech = require('../lib/tech').Tech;
vows.describe('tech').addBatch({
"Tech('../lib/techs/css') /* bem bundled tech */": {
topic: function() {
return new Tech(require.resolve('../lib/techs/css'));
},
".getTechName() equals to 'css'": function(tech) {
assert.equal(tech.getTechName(), 'css');
},
".fileByPrefix('file') equals to 'file.css'": function(tech) {
assert.equal(tech.fileByPrefix('file'), 'file.css');
},
".matchSuffix('.css') returns true": function(tech) {
assert.isTrue(tech.matchSuffix('.css'));
},
".getTechRelativePath() resolves to 'bem/lib/techs/css'": function(tech) {
assert.equal(tech.getTechRelativePath(), 'bem/lib/techs/css');
}
},
"Tech('../lib/techs/default', 'def') /* default tech with custom name */": {
topic: function() {
return new Tech(require.resolve('../lib/techs/default'), 'def');
},
".getTechName() equals to 'def'": function(tech) {
assert.equal(tech.getTechName(), 'def');
},
".fileByPrefix('file') equals to 'file.def'": function(tech) {
assert.equal(tech.fileByPrefix('file'), 'file.def');
},
".matchSuffix('.def') returns true": function(tech) {
assert.isTrue(tech.matchSuffix('.def'));
},
".getTechRelativePath() resolves to '' (empty string)": function(tech) {
assert.equal(tech.getTechRelativePath(), '');
}
},
"Tech('./data/techs/test.js') /* custom tech */": {
topic: function() {
return new Tech(require.resolve('./data/techs/test.js'));
},
".getTechName() equals to 'test.js'": function(tech) {
assert.equal(tech.getTechName(), 'test.js');
},
".fileByPrefix('file') equals to 'file.test.js'": function(tech) {
assert.equal(tech.fileByPrefix('file'), 'file.test.js');
},
".matchSuffix('.test.js') returns true": function(tech) {
assert.isTrue(tech.matchSuffix('.test.js'));
},
".getTechRelativePath('./') resolves to 'data/techs/test.js'": function(tech) {
assert.equal(tech.getTechRelativePath(__dirname), 'data/techs/test.js');
}
}
}).export(module);