summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2023-10-26 22:04:57 -0700
committerMatthew Miller <matthew@millerti.me>2023-10-26 22:04:57 -0700
commit763f0b6734c8f0362d015e5b3fae4784f8e7c7f7 (patch)
treee346abd6b2b1d1b26366cb34602c4964b4533aea /packages/server/src
parent8dc0d13769240486c0933529542d8b93357a01a1 (diff)
Fix tests in build
Diffstat (limited to 'packages/server/src')
-rw-r--r--packages/server/src/helpers/iso/isoCrypto/getWebCrypto.test.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/server/src/helpers/iso/isoCrypto/getWebCrypto.test.ts b/packages/server/src/helpers/iso/isoCrypto/getWebCrypto.test.ts
index 5a1ad92..26025b8 100644
--- a/packages/server/src/helpers/iso/isoCrypto/getWebCrypto.test.ts
+++ b/packages/server/src/helpers/iso/isoCrypto/getWebCrypto.test.ts
@@ -4,6 +4,9 @@ import { returnsNext, stub } from 'https://deno.land/std@0.198.0/testing/mock.ts
import { _getWebCryptoInternals, getWebCrypto, MissingWebCrypto } from './getWebCrypto.ts';
Deno.test('should return globalThis.crypto when present', async () => {
+ // Clear whatever version of crypto might have been set
+ _getWebCryptoInternals.setCachedCrypto(undefined);
+
// Pretend globalThis.crypto exists
const newGlobalThisCrypto = {};
const mockGlobalThisCrypto = stub(
@@ -21,6 +24,9 @@ Deno.test('should return globalThis.crypto when present', async () => {
});
Deno.test('should return node:crypto.webcrypto when globalThis.crypto is missing', async () => {
+ // Clear whatever version of crypto might have been set
+ _getWebCryptoInternals.setCachedCrypto(undefined);
+
// Pretend globalThis.crypto doesn't exist
const mockGlobalThisCrypto = stub(
_getWebCryptoInternals,
@@ -49,6 +55,9 @@ Deno.test('should return node:crypto.webcrypto when globalThis.crypto is missing
Deno.test(
'should return globalThis.crypto when present, while node:crypto.webcrypto is present',
async () => {
+ // Clear whatever version of crypto might have been set
+ _getWebCryptoInternals.setCachedCrypto(undefined);
+
// Pretend globalThis.crypto exists
const fakeGlobalThisCrypto = {};
const mockGlobalThisCrypto = stub(
@@ -79,6 +88,9 @@ Deno.test(
Deno.test(
'should return globalThis.crypto when present, while node:crypto is present but missing webcrypto',
async () => {
+ // Clear whatever version of crypto might have been set
+ _getWebCryptoInternals.setCachedCrypto(undefined);
+
// Pretend globalThis.crypto exists
const fakeGlobalThisCrypto = {};
const mockGlobalThisCrypto = stub(