forked from discordjs/discord.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e3530b
commit 682a84b
Showing
7 changed files
with
117 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
import { test, expect, vitest } from 'vitest'; | ||
import { methods } from '../src/util/Secretbox'; | ||
import { methods, secretboxLoadPromise } from '../src/util/Secretbox'; | ||
|
||
async function wait(ms: number) { | ||
/* eslint-disable no-promise-executor-return */ | ||
return new Promise((resolve) => setTimeout(resolve, ms)); | ||
} | ||
vitest.mock('@noble/ciphers/chacha'); | ||
|
||
vitest.mock('@stablelib/xchacha20poly1305'); | ||
|
||
test('Does not throw error with a package installed', async () => { | ||
// TODO: what is this even testing exactly? | ||
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 wait(100); | ||
await secretboxLoadPromise; | ||
|
||
expect(() => methods.crypto_aead_xchacha20poly1305_ietf_decrypt()).not.toThrowError(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.