Skip to content

Commit f0f45b4

Browse files
committed
Fix unit tests.
1 parent 6ebf8cc commit f0f45b4

File tree

5 files changed

+54
-34
lines changed

5 files changed

+54
-34
lines changed

packages/extract-css/test/main.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ describe('extract-css', () => {
3838
preserveMediaQueries: false
3939
};
4040
compare(
41-
path.join('test', 'fixtures', 'in.html'),
42-
path.join('test', 'expected', 'out.html'),
43-
path.join('test', 'expected', 'file.css'),
41+
path.join(__dirname, 'fixtures', 'in.html'),
42+
path.join(__dirname, 'expected', 'out.html'),
43+
path.join(__dirname, 'expected', 'file.css'),
4444
options,
4545
done
4646
);
@@ -55,9 +55,9 @@ describe('extract-css', () => {
5555
preserveMediaQueries: false
5656
};
5757
compare(
58-
path.join('test', 'fixtures', 'malformed.html'),
59-
path.join('test', 'expected', 'malformed.html'),
60-
path.join('test', 'expected', 'malformed.css'),
58+
path.join(__dirname, 'fixtures', 'malformed.html'),
59+
path.join(__dirname, 'expected', 'malformed.html'),
60+
path.join(__dirname, 'expected', 'malformed.css'),
6161
options,
6262
done
6363
);
@@ -72,9 +72,9 @@ describe('extract-css', () => {
7272
preserveMediaQueries: false
7373
};
7474
compare(
75-
path.join('test', 'fixtures', 'codeblocks.html'),
76-
path.join('test', 'expected', 'codeblocks.html'),
77-
path.join('test', 'expected', 'codeblocks.css'),
75+
path.join(__dirname, 'fixtures', 'codeblocks.html'),
76+
path.join(__dirname, 'expected', 'codeblocks.html'),
77+
path.join(__dirname, 'expected', 'codeblocks.css'),
7878
options,
7979
done
8080
);

packages/list-stylesheets/test/main.js

+25-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* jshint node: true */
1+
/* eslint-disable */
22

33
const should = require('should');
44
const fs = require('fs');
@@ -31,7 +31,12 @@ describe('list-stylesheets', () => {
3131
done();
3232
}
3333

34-
compare(path.join('test', 'fixtures', 'in.html'), path.join('test', 'expected', 'out.html'), options, done);
34+
compare(
35+
path.join(__dirname, 'fixtures', 'in.html'),
36+
path.join(__dirname, 'expected', 'out.html'),
37+
options,
38+
done
39+
);
3540
});
3641

3742
it('Should ignore hbs code blocks', done => {
@@ -49,7 +54,12 @@ describe('list-stylesheets', () => {
4954
done();
5055
}
5156

52-
compare(path.join('test', 'fixtures', 'codeblocks.html'), path.join('test', 'expected', 'codeblocks.html'), options, done);
57+
compare(
58+
path.join(__dirname, 'fixtures', 'codeblocks.html'),
59+
path.join(__dirname, 'expected', 'codeblocks.html'),
60+
options,
61+
done
62+
);
5363
});
5464

5565
it('Should ignore ejs code blocks', done => {
@@ -67,7 +77,12 @@ describe('list-stylesheets', () => {
6777
done();
6878
}
6979

70-
compare(path.join('test', 'fixtures', 'ejs.html'), path.join('test', 'expected', 'ejs.html'), options, done);
80+
compare(
81+
path.join(__dirname, 'fixtures', 'ejs.html'),
82+
path.join(__dirname, 'expected', 'ejs.html'),
83+
options,
84+
done
85+
);
7186
});
7287

7388
it('Should ignore user defined code blocks', done => {
@@ -85,6 +100,11 @@ describe('list-stylesheets', () => {
85100
done();
86101
}
87102

88-
compare(path.join('test', 'fixtures', 'codeblocks-external.html'), path.join('test', 'expected', 'codeblocks-external.html'), options, done);
103+
compare(
104+
path.join(__dirname, 'fixtures', 'codeblocks-external.html'),
105+
path.join(__dirname, 'expected', 'codeblocks-external.html'),
106+
options,
107+
done
108+
);
89109
});
90110
});

packages/mediaquery-text/test/main.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ const mediaQueryText = require('../index');
88
describe('mediaquery-text', () => {
99
it('Should return Media Query text for a CSS source', done => {
1010
const mediaQueries = mediaQueryText(
11-
String(fs.readFileSync(path.join('test', 'fixtures', 'file.css')))
11+
String(fs.readFileSync(path.join(__dirname, 'fixtures', 'file.css')))
1212
);
1313
mediaQueries.should.be.equal(
14-
String(fs.readFileSync(path.join('test', 'expected', 'file.css')))
14+
String(fs.readFileSync(path.join(__dirname, 'expected', 'file.css')))
1515
);
1616
done();
1717
});
1818

1919
it('Should return Media Query text for a CSS source with @font-face', done => {
2020
const mediaQueries = mediaQueryText(
21-
String(fs.readFileSync(path.join('test', 'fixtures', 'font-face.css')))
21+
String(fs.readFileSync(path.join(__dirname, 'fixtures', 'font-face.css')))
2222
);
2323
mediaQueries.should.be.equal(
24-
String(fs.readFileSync(path.join('test', 'expected', 'font-face.css')))
24+
String(fs.readFileSync(path.join(__dirname, 'expected', 'font-face.css')))
2525
);
2626
done();
2727
});

packages/style-data/test/expected/data-embed/out.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<link rel="stylesheet" href="file.css">
66
</head>
77
<body>
8-
<style data-embed="">
8+
<style data-embed>
99
.headline {
1010
color: blue;
1111
}
1212
</style>
13-
<style data-embed="">
13+
<style data-embed>
1414
.headline {
1515
color: green;
1616
}

packages/style-data/test/main.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ describe('style-data', () => {
3232
};
3333

3434
compare(
35-
path.join('test', 'fixtures', 'in.html'),
36-
path.join('test', 'expected', 'out.html'),
35+
path.join(__dirname, 'fixtures', 'in.html'),
36+
path.join(__dirname, 'expected', 'out.html'),
3737
[ '\n h1 {\n border: 1px solid #ccc;\n }\n ' ],
3838
options,
3939
done
@@ -48,8 +48,8 @@ describe('style-data', () => {
4848
};
4949

5050
compare(
51-
path.join('test', 'fixtures', 'no-style-tag', 'in.html'),
52-
path.join('test', 'expected', 'no-style-tag', 'out.html'),
51+
path.join(__dirname, 'fixtures', 'no-style-tag', 'in.html'),
52+
path.join(__dirname, 'expected', 'no-style-tag', 'out.html'),
5353
[],
5454
options,
5555
done
@@ -64,8 +64,8 @@ describe('style-data', () => {
6464
};
6565

6666
compare(
67-
path.join('test', 'fixtures', 'media-queries', 'in.html'),
68-
path.join('test', 'expected', 'media-queries', 'out.html'),
67+
path.join(__dirname, 'fixtures', 'media-queries', 'in.html'),
68+
path.join(__dirname, 'expected', 'media-queries', 'out.html'),
6969
[ '\n h1 {\n border: 1px solid #ccc;\n }\n ', '\n @media only screen and (min-width: 640px) {\n .headline {\n color: blue;\n }\n }\n ' ],
7070
options,
7171
done
@@ -80,8 +80,8 @@ describe('style-data', () => {
8080
};
8181

8282
compare(
83-
path.join('test', 'fixtures', 'codeblocks.html'),
84-
path.join('test', 'expected', 'codeblocks.html'),
83+
path.join(__dirname, 'fixtures', 'codeblocks.html'),
84+
path.join(__dirname, 'expected', 'codeblocks.html'),
8585
[],
8686
options,
8787
done
@@ -96,8 +96,8 @@ describe('style-data', () => {
9696
};
9797

9898
compare(
99-
path.join('test', 'fixtures', 'ejs.html'),
100-
path.join('test', 'expected', 'ejs.html'),
99+
path.join(__dirname, 'fixtures', 'ejs.html'),
100+
path.join(__dirname, 'expected', 'ejs.html'),
101101
[],
102102
options,
103103
done
@@ -112,8 +112,8 @@ describe('style-data', () => {
112112
};
113113

114114
compare(
115-
path.join('test', 'fixtures', 'codeblocks-external.html'),
116-
path.join('test', 'expected', 'codeblocks-external.html'),
115+
path.join(__dirname, 'fixtures', 'codeblocks-external.html'),
116+
path.join(__dirname, 'expected', 'codeblocks-external.html'),
117117
[],
118118
options,
119119
done
@@ -128,8 +128,8 @@ describe('style-data', () => {
128128
};
129129

130130
compare(
131-
path.join('test', 'fixtures', 'data-embed', 'in.html'),
132-
path.join('test', 'expected', 'data-embed', 'out.html'),
131+
path.join(__dirname, 'fixtures', 'data-embed', 'in.html'),
132+
path.join(__dirname, 'expected', 'data-embed', 'out.html'),
133133
[ '\n h1 {\n border: 1px solid #ccc;\n }\n ' ],
134134
options,
135135
done

0 commit comments

Comments
 (0)