fix shoot
This commit is contained in:
parent
5f26773c61
commit
c939a8a0c1
3 changed files with 4 additions and 4 deletions
|
|
@ -136,7 +136,7 @@ extend(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
export const queryCode = async (code, cycles) => {
|
export const queryCode = async (code, cycles = 1) => {
|
||||||
const { pattern } = await evaluate(code);
|
const { pattern } = await evaluate(code);
|
||||||
const haps = pattern.queryArc(0, cycles);
|
const haps = pattern.queryArc(0, cycles);
|
||||||
return haps.map((h) => h.showWhole());
|
return haps.map((h) => h.showWhole());
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
// this script will render all example tunes and log them to the console.
|
// this script will render all example tunes and log them to the console.
|
||||||
// it is intended to be written to tunes.snapshot.mjs using `npm run snapshot`
|
// it is intended to be written to tunes.snapshot.mjs using `npm run snapshot`
|
||||||
|
|
||||||
import * as tunes from '../tunes.mjs';
|
import * as tunes from './tunes.mjs';
|
||||||
import { queryCode } from './runtime.mjs';
|
import { queryCode } from './runtime.mjs';
|
||||||
|
|
||||||
Object.entries(tunes).forEach(([key, code]) => {
|
Object.entries(tunes).forEach(([key, code]) => {
|
||||||
queryCode(code, 1).then((haps) => {
|
queryCode(code).then((haps) => {
|
||||||
console.log(`export const ${key} = ${JSON.stringify(haps, null, 1)}`);
|
console.log(`export const ${key} = ${JSON.stringify(haps, null, 1)}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { strict as assert } from 'assert';
|
||||||
describe('tunes', () => {
|
describe('tunes', () => {
|
||||||
it('renders tunes correctly', async () => {
|
it('renders tunes correctly', async () => {
|
||||||
async function testTune(key) {
|
async function testTune(key) {
|
||||||
const haps = await queryCode(tunes[key], 1);
|
const haps = await queryCode(tunes[key]);
|
||||||
assert.deepStrictEqual(haps, snaps[key]);
|
assert.deepStrictEqual(haps, snaps[key]);
|
||||||
}
|
}
|
||||||
await Promise.all(Object.keys(tunes).map(testTune));
|
await Promise.all(Object.keys(tunes).map(testTune));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue