mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-27 21:53:10 +02:00
Add mocks for Web Audio API (#12457)
This commit is contained in:
parent
95095ee8d1
commit
c8b85a98b8
1 changed files with 18 additions and 0 deletions
|
@ -25,3 +25,21 @@ vi.mock('@/store.js', () => {
|
|||
},
|
||||
};
|
||||
});
|
||||
|
||||
// Add mocks for Web Audio API
|
||||
const AudioNodeMock = vi.fn(() => ({
|
||||
connect: vi.fn(() => ({ connect: vi.fn() })),
|
||||
start: vi.fn(),
|
||||
}));
|
||||
|
||||
const GainNodeMock = vi.fn(() => ({
|
||||
gain: vi.fn(),
|
||||
}));
|
||||
|
||||
const AudioContextMock = vi.fn(() => ({
|
||||
createBufferSource: vi.fn(() => new AudioNodeMock()),
|
||||
createGain: vi.fn(() => new GainNodeMock()),
|
||||
decodeAudioData: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.stubGlobal('AudioContext', AudioContextMock);
|
||||
|
|
Loading…
Reference in a new issue