fix tests after moving to pnpm

This commit is contained in:
fkwp
2026-04-17 11:13:41 +02:00
parent 9c1719a22f
commit 2b42b2bdc1
7 changed files with 82 additions and 8 deletions

View File

@@ -74,7 +74,26 @@ const panNode = vi.mocked(
* It can also be used to mock the `AudioContext` constructor in tests:
* `vi.stubGlobal("AudioContext", () => testAudioContext);`
*/
export const testAudioContext = {
export const testAudioContext: Partial<AudioContext> & {
gain: ReturnType<
typeof vi.mocked<{
connect: (node: AudioNode) => AudioNode;
gain: { setValueAtTime: ReturnType<typeof vi.fn>; value: number };
}>
>;
pan: ReturnType<
typeof vi.mocked<{
connect: (node: AudioNode) => AudioNode;
pan: { setValueAtTime: ReturnType<typeof vi.fn>; value: number };
}>
>;
setSinkId: ReturnType<typeof vi.fn>;
decodeAudioData: ReturnType<typeof vi.fn>;
createBufferSource: ReturnType<typeof vi.fn>;
createGain: ReturnType<typeof vi.fn>;
createStereoPanner: ReturnType<typeof vi.fn>;
close: ReturnType<typeof vi.fn>;
} = {
gain: gainNode,
pan: panNode,
setSinkId: vi.fn().mockResolvedValue(undefined),