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
2 changed files with 12 additions and 5 deletions
Showing only changes of commit b29fda5ae9 - Show all commits
+8 -1
View File
@@ -89,7 +89,14 @@ export default class AudioManager {
});
this.connection.subscribe(this.audioPlayer);
await entersState(this.connection, VoiceConnectionStatus.Ready, this.options.connectTimeoutMs);
try {
await entersState(this.connection, VoiceConnectionStatus.Ready, this.options.connectTimeoutMs);
} catch (error) {
this.connection.destroy();
this.connection = undefined;
this.playbackState = 'stopped';
throw error;
}
this.playbackState = 'ready';
this.scheduleRenewal();
}
6
+4 -4
View File
@@ -101,7 +101,7 @@ describe('AudioManager', () => {
expect(mockAudioPlayer.play).toHaveBeenCalledWith(mockAudioResource);
});
it('keeps failed connection startup observable', async () => {
it('cleans up when connection startup fails', async () => {
jest.useFakeTimers();
const manager = new AudioManager({
@@ -112,10 +112,10 @@ describe('AudioManager', () => {
await expect(manager.connect()).rejects.toThrow('voice connection timeout');
expect(manager.state).toBe('connecting');
expect(manager.isConnected).toBe(true);
expect(manager.state).toBe('stopped');
expect(manager.isConnected).toBe(false);
expect(mockConnection.subscribe).toHaveBeenCalledWith(mockAudioPlayer);
expect(mockConnection.destroy).not.toHaveBeenCalled();
expect(mockConnection.destroy).toHaveBeenCalledTimes(1);
expect(jest.getTimerCount()).toBe(0);
});