mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-24 23:15:13 +00: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