mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 02:53:31 +01:00
build: Properly add typecheck tests (#10722)
* build: exclude type tests from running * refactor: use `tsc` * test: fix broker test * test: fix voice test * test: fix builders test * test: use vitest typecheck remove unused test scripts skip lib check rm vitest.d.ts * fix: remove tsd from core and ws * fix: extend local tsconfig --------- Co-authored-by: almeidx <github@almeidx.dev> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -256,12 +256,9 @@ describe('State transitions', () => {
|
||||
expect(connection.dispatchAudio).toHaveBeenCalledTimes(6);
|
||||
await wait();
|
||||
player['_stepPrepare']();
|
||||
const prepareAudioPacket = connection.prepareAudioPacket as unknown as Mock<
|
||||
[Buffer],
|
||||
typeof connection.prepareAudioPacket
|
||||
>;
|
||||
const prepareAudioPacket = connection.prepareAudioPacket as unknown as Mock<typeof connection.prepareAudioPacket>;
|
||||
expect(prepareAudioPacket).toHaveBeenCalledTimes(6);
|
||||
expect(prepareAudioPacket.mock.calls[5][0]).toEqual(silence().next().value);
|
||||
expect(prepareAudioPacket.mock.calls[5]![0]).toEqual(silence().next().value);
|
||||
|
||||
player.stop(true);
|
||||
expect(player.state.status).toEqual(AudioPlayerStatus.Idle);
|
||||
@@ -314,10 +311,7 @@ describe('State transitions', () => {
|
||||
|
||||
await wait();
|
||||
expect(player.checkPlayable()).toEqual(false);
|
||||
const prepareAudioPacket = connection.prepareAudioPacket as unknown as Mock<
|
||||
[Buffer],
|
||||
typeof connection.prepareAudioPacket
|
||||
>;
|
||||
const prepareAudioPacket = connection.prepareAudioPacket as unknown as Mock<typeof connection.prepareAudioPacket>;
|
||||
expect(prepareAudioPacket).toHaveBeenCalledTimes(5);
|
||||
|
||||
expect(player.state.status).toEqual(AudioPlayerStatus.Idle);
|
||||
@@ -348,10 +342,7 @@ describe('State transitions', () => {
|
||||
expect(addAudioPlayer).toBeCalledTimes(1);
|
||||
expect(player.checkPlayable()).toEqual(true);
|
||||
|
||||
const prepareAudioPacket = connection.prepareAudioPacket as unknown as Mock<
|
||||
[Buffer],
|
||||
typeof connection.prepareAudioPacket
|
||||
>;
|
||||
const prepareAudioPacket = connection.prepareAudioPacket as unknown as Mock<typeof connection.prepareAudioPacket>;
|
||||
|
||||
// Run through a few packet cycles
|
||||
for (let index = 1; index <= 5; index++) {
|
||||
@@ -363,7 +354,7 @@ describe('State transitions', () => {
|
||||
expect(connection.dispatchAudio).toHaveBeenCalledTimes(index);
|
||||
player['_stepPrepare']();
|
||||
expect(prepareAudioPacket).toHaveBeenCalledTimes(index);
|
||||
expect(prepareAudioPacket.mock.calls[index - 1][0]).toEqual(silence().next().value);
|
||||
expect(prepareAudioPacket.mock.calls[index - 1]![0]).toEqual(silence().next().value);
|
||||
}
|
||||
|
||||
expect(player.state.status).toEqual(AudioPlayerStatus.Idle);
|
||||
|
||||
@@ -8,5 +8,12 @@ test.skip('Does not throw error with a package installed', async () => {
|
||||
// The async loop in Secretbox will not have finished importing unless we wait
|
||||
await secretboxLoadPromise;
|
||||
|
||||
expect(() => methods.crypto_aead_xchacha20poly1305_ietf_decrypt()).not.toThrowError();
|
||||
expect(() =>
|
||||
methods.crypto_aead_xchacha20poly1305_ietf_decrypt(
|
||||
Buffer.from(''),
|
||||
Buffer.from(''),
|
||||
Buffer.from(''),
|
||||
Buffer.from(''),
|
||||
),
|
||||
).not.toThrowError();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user