Skip to content

Commit c0c2990

Browse files
test: code coverange
1 parent 908ecee commit c0c2990

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

test/runtime/__snapshots__/api.test.js.snap

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
exports[`api should import modules 1`] = `"body { b: 2; }body { c: 3; }body { b: 2; }@media print {body { b: 2; }}@media print {body { d: 4; }}@media screen and (orientation:landscape) {body { a: 1; }}@media (orientation:landscape) {body { a: 1; }}"`;
44

5+
exports[`api should import modules when module string 1`] = `".button { b: 2; }"`;
6+
7+
exports[`api should import modules with dedupe 1`] = `"body { b: 1; }body { b: 2; }.button { b: 3; }"`;
8+
59
exports[`api should import named modules 1`] = `"body { b: 2; }body { c: 3; }body { b: 2; }@media print {body { b: 2; }}@media print {body { d: 4; }}@media screen {body { a: 1; }}"`;
610

711
exports[`api should toString a single module 1`] = `"body { a: 1; }"`;

test/runtime/api.test.js

+25
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,29 @@ describe('api', () => {
137137

138138
expect(m.toString()).toMatchSnapshot();
139139
});
140+
141+
it('should import modules with dedupe', () => {
142+
const m = api();
143+
144+
const m1 = ['./module1', 'body { b: 1; }', ''];
145+
const m2 = ['./module2', 'body { b: 2; }', ''];
146+
const m3 = ['./module3', '.button { b: 3; }', ''];
147+
148+
m.i([m1], '', true);
149+
m.i([m2], '', true);
150+
m.i([m3], '', true);
151+
m.i([m3], '', true);
152+
m.i([m3], '', true);
153+
154+
expect(m.toString()).toMatchSnapshot();
155+
expect(m.length).toBe(3);
156+
});
157+
158+
it('should import modules when module string', () => {
159+
const m = api();
160+
161+
m.i('.button { b: 2; }');
162+
163+
expect(m.toString()).toMatchSnapshot();
164+
});
140165
});

0 commit comments

Comments
 (0)