more readable tune test + longer snaps

This commit is contained in:
Felix Roos 2022-05-01 23:13:54 +02:00
parent c939a8a0c1
commit a119b83b65
5 changed files with 93 additions and 1165 deletions

View file

@ -1,14 +1,18 @@
import { queryCode } from '../runtime.mjs';
import { queryCode, testCycles } from '../runtime.mjs';
import * as snaps from '../tunes.snapshot.mjs';
import * as tunes from '../tunes.mjs';
import { strict as assert } from 'assert';
describe('tunes', () => {
it('renders tunes correctly', async () => {
async function testTune(key) {
const haps = await queryCode(tunes[key]);
assert.deepStrictEqual(haps, snaps[key]);
}
await Promise.all(Object.keys(tunes).map(testTune));
async function testTune(key) {
// console.log('test tune', key);
const haps = await queryCode(tunes[key], testCycles[key] || 1);
assert.deepStrictEqual(haps, snaps[key]);
}
describe('renders tunes', () => {
Object.keys(tunes).forEach((key) => {
it(`tune: ${key}`, async () => {
await testTune(key);
});
});
});