Skip to content

Commit

Permalink
fix: add missing unit test about waterfall includes
Browse files Browse the repository at this point in the history
  • Loading branch information
learosema committed Oct 17, 2024
1 parent f059516 commit be793db
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tests/css.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ describe('css plugin', () => {
`@import "A.css";`,
`@import "B.css";`,
].join('\n'));
virtualFileSystem.set('A.css', '.a {color: red; }');
virtualFileSystem.set('B.css', '.b {color: green }');
virtualFileSystem.set('A.css', '.a { color: red; }');
virtualFileSystem.set('B.css', '.b { color: green; }');
virtualFileSystem.set('C.css', '@import "styles.css";\n.c { color: blue; }\n');

function dummyResolver(...paths) {
const resource = path.normalize(path.join(...paths));
Expand Down Expand Up @@ -50,7 +51,21 @@ describe('css plugin', () => {
const transform = await config.extensions.get('css').compile(virtualFileSystem.get('styles.css'), 'styles.css');
const result = await transform();

assert(result === expectedFile);
assert.equal(result, expectedFile);
});

it('should handle waterfall includes', async () => {
const expectedFile = [
'.a { color: red; }',
'.b { color: green; }',
'.c { color: blue; }\n'
].join('\n');

const transform = await config.extensions.get('css').compile(virtualFileSystem.get('C.css'), 'C.css');
const result = await transform();

assert.equal(result, expectedFile);
});


});

0 comments on commit be793db

Please sign in to comment.