From 3cb5854d50b0f5e45bfc235175632790f6f7563f Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Fri, 29 Apr 2022 14:55:24 +0100 Subject: [PATCH 1/2] chore: lint with standard --- test/hook.test.js | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/test/hook.test.js b/test/hook.test.js index 06fcd3c..196de3d 100644 --- a/test/hook.test.js +++ b/test/hook.test.js @@ -15,7 +15,7 @@ test('hook rejects for missing header', (t) => { } const response = { code: () => response, - send: send + send } function send (body) { @@ -37,8 +37,8 @@ test('hook rejects for missing header with custom content type', (t) => { } const response = { code: () => response, - header: header, - send: send + header, + send } function header (key, value) { t.ok(key) @@ -66,7 +66,7 @@ test('hook rejects header without bearer prefix', (t) => { } const response = { code: () => response, - send: send + send } function send (body) { @@ -89,7 +89,7 @@ test('hook rejects malformed header', (t) => { } const response = { code: () => response, - send: send + send } function send (body) { @@ -112,7 +112,7 @@ test('hook accepts correct header', (t) => { } const response = { code: () => response, - send: send + send } function send (body) { @@ -138,7 +138,7 @@ test('hook accepts correct header and alternate Bearer', (t) => { } const response = { code: () => response, - send: send + send } function send (body) { @@ -162,7 +162,7 @@ test('hook accepts correct header with extra padding', (t) => { } const response = { code: () => response, - send: send + send } function send (body) { @@ -189,7 +189,7 @@ test('hook accepts correct header with auth function (promise)', (t) => { } const response = { code: () => response, - send: send + send } function send (body) { @@ -216,7 +216,7 @@ test('hook accepts correct header with auth function (non-promise)', (t) => { } const response = { code: () => response, - send: send + send } function send (body) { @@ -240,7 +240,7 @@ test('hook rejects wrong token with keys', (t) => { } const response = { code: () => response, - send: send + send } function send (body) { @@ -266,8 +266,8 @@ test('hook rejects wrong token with custom content type', (t) => { } const response = { code: () => response, - header: header, - send: send + header, + send } function header (key, value) { t.ok(key) @@ -305,7 +305,7 @@ test('hook rejects wrong token with auth function', (t) => { t.equal(401, status) return response }, - send: send + send } function send (body) { @@ -338,7 +338,7 @@ test('hook rejects wrong token with function (resolved promise)', (t) => { t.equal(401, status) return response }, - send: send + send } function send (body) { @@ -371,7 +371,7 @@ test('hook rejects with 500 when functions fails', (t) => { t.equal(500, status) return response }, - send: send + send } function send (body) { @@ -404,7 +404,7 @@ test('hook rejects with 500 when promise rejects', (t) => { t.equal(500, status) return response }, - send: send + send } function send (body) { @@ -437,7 +437,7 @@ test('hook rejects with 500 when promise rejects with non Error', (t) => { t.equal(500, status) return response }, - send: send + send } function send (body) { @@ -465,7 +465,7 @@ test('hook returns proper error for valid key but failing callback', (t) => { t.equal(500, status) return response }, - send: send + send } function send (body) { @@ -501,7 +501,7 @@ test('hook rejects with 500 when functions returns non-boolean', (t) => { t.equal(500, status) return response }, - send: send + send } function send (body) { @@ -534,7 +534,7 @@ test('hook rejects with 500 when promise resolves to non-boolean', (t) => { t.equal(500, status) return response }, - send: send + send } function send (body) { From 7d14b5ee062e800da2087903192c958a5b7690d4 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Fri, 29 Apr 2022 14:56:13 +0100 Subject: [PATCH 2/2] build(deps-dev): use new @fastify org dependencies --- package.json | 2 +- test/integration.test.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index f3beaf1..ac2263c 100644 --- a/package.json +++ b/package.json @@ -29,9 +29,9 @@ }, "homepage": "https://github.com/fastify/fastify-bearer-auth#readme", "devDependencies": { + "@fastify/auth": "^2.0.0", "@types/node": "^17.0.0", "fastify": "^3.0.0", - "fastify-auth": "^1.0.1", "pre-commit": "^1.2.2", "snazzy": "^9.0.0", "standard": "^17.0.0", diff --git a/test/integration.test.js b/test/integration.test.js index c2cf222..d57e803 100644 --- a/test/integration.test.js +++ b/test/integration.test.js @@ -53,7 +53,7 @@ test('missing header route fails correctly', (t) => { }) }) -test('integration with fastify-auth', async (t) => { +test('integration with @fastify/auth', async (t) => { t.plan(3) const fastify = require('fastify')() @@ -64,7 +64,7 @@ test('integration with fastify-auth', async (t) => { } return done(new Error('not anonymous')) }) - await fastify.register(require('fastify-auth')) + await fastify.register(require('@fastify/auth')) fastify.route({ method: 'GET', @@ -114,7 +114,7 @@ test('integration with fastify-auth', async (t) => { }) }) -test('integration with fastify-auth; not the last auth option', async (t) => { +test('integration with @fastify/auth; not the last auth option', async (t) => { t.plan(3) const fastify = require('fastify')() @@ -122,7 +122,7 @@ test('integration with fastify-auth; not the last auth option', async (t) => { await fastify.decorate('alwaysValidAuth', function (request, _, done) { return done() }) - await fastify.register(require('fastify-auth')) + await fastify.register(require('@fastify/auth')) fastify.route({ method: 'GET',