Update unit test

This commit is contained in:
Eric Rosenbaum 2017-11-15 14:10:50 -05:00
parent 01e9000c04
commit ba529ad50b

View file

@ -4,7 +4,6 @@ let playedDrum;
let playedInstrument; let playedInstrument;
const runtime = { const runtime = {
audioEngine: { audioEngine: {
numDrums: 3,
numInstruments: 3, numInstruments: 3,
instrumentPlayer: { instrumentPlayer: {
loadInstrument: instrument => (playedInstrument = instrument) loadInstrument: instrument => (playedInstrument = instrument)
@ -12,13 +11,14 @@ const runtime = {
} }
}; };
const blocks = new Music(runtime); const blocks = new Music(runtime);
blocks._playDrumNum = (util, drum) => (playedDrum = drum);
const util = { const util = {
stackFrame: Object.create(null),
target: { target: {
audioPlayer: { audioPlayer: null
playDrumForBeats: drum => (playedDrum = drum)
}
}, },
stackFrame: Object.create(null) yield: () => null
}; };
test('playDrum uses 1-indexing and wrap clamps', t => { test('playDrum uses 1-indexing and wrap clamps', t => {
@ -26,7 +26,7 @@ test('playDrum uses 1-indexing and wrap clamps', t => {
blocks.playDrumForBeats(args, util); blocks.playDrumForBeats(args, util);
t.strictEqual(playedDrum, 0); t.strictEqual(playedDrum, 0);
args = {DRUM: runtime.audioEngine.numDrums + 1}; args = {DRUM: blocks.DRUM_INFO.length + 1};
blocks.playDrumForBeats(args, util); blocks.playDrumForBeats(args, util);
t.strictEqual(playedDrum, 0); t.strictEqual(playedDrum, 0);