From 58f418b0f019c96ff7b03e74a63762eb0f6c7457 Mon Sep 17 00:00:00 2001 From: Samuel Kopp <62482066+boywithkeyboard@users.noreply.github.com> Date: Sun, 20 Aug 2023 15:39:14 +0200 Subject: [PATCH] fix test suite --- test/jwt.test.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/jwt.test.ts b/test/jwt.test.ts index e60145b..c9ce9d3 100644 --- a/test/jwt.test.ts +++ b/test/jwt.test.ts @@ -1,20 +1,16 @@ // Copyright 2023 Samuel Kopp. All rights reserved. Apache-2.0 license. import { cheetah } from '../cheetah.ts' -import { createKey, importKey } from '../jwt.ts' +import { createJwtSecret } from '../cli/cmd/random/create_jwt_secret.ts' import { jwt } from '../mod.ts' -import { assertEquals, assertInstanceOf } from '../test/deps.ts' +import { assertEquals } from '../test/deps.ts' Deno.test('jwt', async () => { - const key = await createKey() - const cryptoKey = await importKey(key) - - assertInstanceOf(cryptoKey, CryptoKey) + const key = await createJwtSecret() const token = await jwt.sign(key, { example: 'object' }) - assertEquals(await jwt.verify(await createKey(), token) === undefined, true) + assertEquals(await jwt.verify(await createJwtSecret(), token) === undefined, true) assertEquals(await jwt.verify(key, token) !== undefined, true) - assertEquals(await jwt.verify(cryptoKey, token) !== undefined, true) Deno.env.set('jwt_secret', key)