mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Update unit test
This commit is contained in:
parent
01e9000c04
commit
ba529ad50b
1 changed files with 6 additions and 6 deletions
|
@ -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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue