Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WP]test: #5555 migrate from tap to node:test #364

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions test/jwt-async.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const test = require('tap').test
const test = require('node:test')
const Fastify = require('fastify')
const jwt = require('../jwt')
const { createSigner } = require('fast-jwt')
Expand Down Expand Up @@ -30,9 +30,9 @@ test('Async key provider should be resolved internally', async function (t) {
jwt: 'supersecret'
}
})
t.ok(response)
t.comment("Should be 'undefined'")
t.match(response.json(), { user: 'test' })
t.assert.strictEqual(response !== undefined, true)
console.log("Should be 'undefined'")
t.assert.strictEqual(response.json().user, 'test')
})

test('Async key provider errors should be resolved internally', async function (t) {
Expand All @@ -57,8 +57,7 @@ test('Async key provider errors should be resolved internally', async function (
method: 'get',
url: '/'
})

t.equal(response.statusCode, 401)
t.assert.strictEqual(response.statusCode, 401)
})

test('Async key provider should be resolved internally with cache', async function (t) {
Expand Down Expand Up @@ -96,8 +95,8 @@ test('Async key provider should be resolved internally with cache', async functi
method: 'get',
url: '/'
})
t.equal(response.statusCode, 200)
t.match(response.json(), { name: 'John Doe' })
t.assert.strictEqual(response.statusCode, 200)
t.assert.strictEqual(response.json().name, 'John Doe')
})

test('Async key provider errors should be resolved internally with cache', async function (t) {
Expand Down Expand Up @@ -130,6 +129,5 @@ test('Async key provider errors should be resolved internally with cache', async
method: 'get',
url: '/'
})

t.equal(response.statusCode, 401)
t.assert.strictEqual(response.statusCode, 401)
})