UNPKG

scratch-gui

Version:

GraphicaL User Interface for creating and running Scratch 3.0 projects

15 lines (14 loc) 441 B
export default class MockAudioBufferPlayer { constructor (samples, sampleRate) { this.samples = samples; this.sampleRate = sampleRate; this.buffer = { getChannelData: jest.fn(() => samples) }; this.play = jest.fn((trimStart, trimEnd, onUpdate) => { this.onUpdate = onUpdate; }); this.stop = jest.fn(); MockAudioBufferPlayer.instance = this; } }