Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mqxx committed Jan 20, 2024
1 parent 383106c commit 75c6fcc
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.vscode
.vscode/
dist/
63 changes: 63 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions test/convert_scss_to_css.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import * as esbuild from 'https://deno.land/x/[email protected]/mod.js';
import sassPlugin from '../mod.ts';
import { assertEquals } from 'https://deno.land/[email protected]/testing/asserts.ts';

Deno.test(
'Convert SCSS to CSS',
async (test) => {
const sassConfig: esbuild.BuildOptions = {
allowOverwrite: true,
logLevel: 'silent',
color: true,
minify: true,
outfile: './test/dist/bundle.min.css',
entryPoints: [
'./test/src/index.scss',
],
plugins: [
sassPlugin()
],
};

await esbuild.build(sassConfig);

esbuild.stop()

const cssIn = `body{background-color:red}body div{background-color:#00f}\n`;
const cssOut = await Deno.readTextFile('./test/dist/bundle.min.css');

assertEquals(cssOut, cssIn);
}
)
7 changes: 7 additions & 0 deletions test/src/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
body {
background-color: red;

div {
background-color: blue;
}
}

0 comments on commit 75c6fcc

Please sign in to comment.