Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Commit

Permalink
fix test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
boywithkeyboard committed Aug 20, 2023
1 parent 6ef21d6 commit 58f418b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions test/jwt.test.ts
Original file line number Diff line number Diff line change
@@ -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)

Expand Down

0 comments on commit 58f418b

Please sign in to comment.