Skip to content

Commit

Permalink
test: code coverange
Browse files Browse the repository at this point in the history
  • Loading branch information
cap-Bernardito committed Jul 17, 2020
1 parent 908ecee commit 0af02bf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/runtime/__snapshots__/api.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

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; }}"`;

exports[`api should import modules when module string 1`] = `".button { b: 2; }"`;

exports[`api should import modules with dedupe 1`] = `"body { b: 1; }body { b: 2; }.button { b: 3; }"`;

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; }}"`;

exports[`api should toString a single module 1`] = `"body { a: 1; }"`;
Expand Down
26 changes: 26 additions & 0 deletions test/runtime/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,30 @@ describe('api', () => {

expect(m.toString()).toMatchSnapshot();
});

it('should import modules with dedupe', () => {
const m = api();

const m1 = [null, 'body { b: 1; }', ''];
const m2 = ['./module2', 'body { b: 2; }', ''];
const m3 = ['./module3', '.button { b: 3; }', ''];

m.i([m1], '', true);
m.i([m2], '', true);
m.i([m3], '', true);
m.i([m3], '', true);
m.i([m3], '', true);

expect(m.toString()).toMatchSnapshot();
expect(m.length).toBe(3);
});

it('should import modules when module string', () => {
const m = api();

m.i('.button { b: 2; }');
m.i('');

expect(m.toString()).toMatchSnapshot();
});
});

0 comments on commit 0af02bf

Please sign in to comment.