mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 02:23:31 +01:00
chore: monorepo setup (#7175)
This commit is contained in:
42
packages/voice/__tests__/joinVoiceChannel.test.ts
Normal file
42
packages/voice/__tests__/joinVoiceChannel.test.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { joinVoiceChannel } from '../src/joinVoiceChannel';
|
||||
import * as VoiceConnection from '../src/VoiceConnection';
|
||||
|
||||
const adapterCreator = () => ({ destroy: jest.fn(), send: jest.fn() } as any);
|
||||
const createVoiceConnection = jest.spyOn(VoiceConnection, 'createVoiceConnection');
|
||||
|
||||
beforeAll(() => {
|
||||
createVoiceConnection.mockImplementation(() => null as any);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
createVoiceConnection.mockClear();
|
||||
});
|
||||
|
||||
describe('joinVoiceChannel', () => {
|
||||
test('Uses default group', () => {
|
||||
joinVoiceChannel({
|
||||
channelId: '123',
|
||||
guildId: '456',
|
||||
adapterCreator,
|
||||
});
|
||||
expect(createVoiceConnection.mock.calls[0][0]).toMatchObject({
|
||||
channelId: '123',
|
||||
guildId: '456',
|
||||
group: 'default',
|
||||
});
|
||||
});
|
||||
|
||||
test('Respects custom group', () => {
|
||||
joinVoiceChannel({
|
||||
channelId: '123',
|
||||
guildId: '456',
|
||||
group: 'abc',
|
||||
adapterCreator,
|
||||
});
|
||||
expect(createVoiceConnection.mock.calls[0][0]).toMatchObject({
|
||||
channelId: '123',
|
||||
guildId: '456',
|
||||
group: 'abc',
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user