-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.js
76 lines (40 loc) · 1.49 KB
/
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*eslint no-unused-expressions: 0, no-var: 0 */
/*eslint-env node, mocha */
import { expect } from 'chai';
import sass from 'node-sass';
import globImporter from './src';
function getCSS(file) {
return new Promise((resolve, reject) => {
sass.render({
file: `./fixtures/${file}`,
outputStyle: 'compressed',
importer: globImporter()
}, (err, res) => err ? reject(err) : resolve(res.css.toString()));
});
}
describe('sass-glob-importer', () => {
it('should import all dummy files (*.scss)', (done) => {
getCSS('all.scss').then((css) => {
expect(css).to.equal('.one{content:"1 file"}.two{content:"2 file"}.a{content:"a file"}.b{content:"b file"}.c{content:"c file"}.d{content:"d file"}\n');
done();
});
});
it('should import only a few dummy files ([0-9].scss)', (done) => {
getCSS('numbers.scss').then((css) => {
expect(css).to.equal('.one{content:"1 file"}.two{content:"2 file"}\n');
done();
});
});
it('should import all dummy files from a nested folder (*.scss)', (done) => {
getCSS('deep/inside/nested.scss').then((css) => {
expect(css).to.equal('.one{content:"1 file"}.two{content:"2 file"}.a{content:"a file"}.b{content:"b file"}.c{content:"c file"}.d{content:"d file"}\n');
done();
});
});
it('should import a local file', (done) => {
getCSS('local-file.scss').then((css) => {
expect(css).to.exist.and.equal('.d{content:"d file"}\n');
done();
});
});
});