66 67 68 69 70 71 multiple bugs #72

Merged
FrauJulian merged 6 commits from 66-67-68-69-70-71-multiple-bugs into main 2026-06-22 10:43:28 +00:00
Showing only changes of commit 1a77896c32 - Show all commits
+19
View File
@@ -1,4 +1,5 @@
import { jest, describe, beforeEach, afterEach, it, expect } from '@jest/globals';
import { entersState } from '@discordjs/voice';
import { resolve } from 'node:path';
import { PassThrough } from 'node:stream';
@@ -99,6 +100,24 @@ describe('AudioManager', () => {
expect(mockAudioPlayer.play).toHaveBeenCalledWith(mockAudioResource);
});
it('keeps failed connection startup observable', async () => {
jest.useFakeTimers();
const manager = new AudioManager({
connection: connectionOptions,
renewIntervalMs: 10_000,
});
jest.mocked(entersState).mockRejectedValueOnce(new Error('voice connection timeout'));
await expect(manager.connect()).rejects.toThrow('voice connection timeout');
expect(manager.state).toBe('connecting');
expect(manager.isConnected).toBe(true);
expect(mockConnection.subscribe).toHaveBeenCalledWith(mockAudioPlayer);
expect(mockConnection.destroy).not.toHaveBeenCalled();
expect(jest.getTimerCount()).toBe(0);
});
it('starts playback with the committed mp3 test file', async () => {
const manager = new AudioManager({
connection: connectionOptions,