mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-28 15:46:51 -04:00
use vitest snapshot feature for tunes
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"test": "vitest run --reporter verbose -v --no-isolate",
|
||||
"snapshot": "cd ./src/ && rm -f ./tunes.snapshot.mjs && node ./shoot.mjs > ./tunes.snapshot.mjs",
|
||||
"snapshot": "vitest run -u --silent",
|
||||
"add-license": "cat etc/agpl-header.txt ../docs/static/js/*LICENSE.txt > /tmp/strudel-license.txt && cp /tmp/strudel-license.txt ../docs/static/js/*LICENSE.txt",
|
||||
"predeploy": "npm run build",
|
||||
"deploy": "gh-pages -d ../docs",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,14 @@
|
||||
import { queryCode, testCycles } from '../runtime.mjs';
|
||||
import * as snaps from '../tunes.snapshot.mjs';
|
||||
import * as tunes from '../tunes.mjs';
|
||||
import { describe, it } from 'vitest';
|
||||
|
||||
const tuneKeys = Object.keys(tunes);
|
||||
|
||||
async function testTune(key, expect) {
|
||||
const haps = await queryCode(tunes[key], testCycles[key] || 1);
|
||||
expect(haps).toEqual(snaps[key]);
|
||||
}
|
||||
|
||||
describe.concurrent('renders tunes', () => {
|
||||
describe('renders tunes', () => {
|
||||
tuneKeys.forEach((key) => {
|
||||
it(`tune: ${key}`, async ({ expect }) => await testTune(key, expect));
|
||||
it(`tune: ${key}`, async ({ expect }) => {
|
||||
const haps = await queryCode(tunes[key], testCycles[key] || 1);
|
||||
expect(haps).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user