Skip to content

Commit

Permalink
Merge pull request #132 from fastify/build/deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Apr 29, 2022
2 parents 18c5d9a + 7d14b5e commit d86d7fd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
42 changes: 21 additions & 21 deletions test/hook.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test('hook rejects for missing header', (t) => {
}
const response = {
code: () => response,
send: send
send
}

function send (body) {
Expand All @@ -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)
Expand Down Expand Up @@ -66,7 +66,7 @@ test('hook rejects header without bearer prefix', (t) => {
}
const response = {
code: () => response,
send: send
send
}

function send (body) {
Expand All @@ -89,7 +89,7 @@ test('hook rejects malformed header', (t) => {
}
const response = {
code: () => response,
send: send
send
}

function send (body) {
Expand All @@ -112,7 +112,7 @@ test('hook accepts correct header', (t) => {
}
const response = {
code: () => response,
send: send
send
}

function send (body) {
Expand All @@ -138,7 +138,7 @@ test('hook accepts correct header and alternate Bearer', (t) => {
}
const response = {
code: () => response,
send: send
send
}

function send (body) {
Expand All @@ -162,7 +162,7 @@ test('hook accepts correct header with extra padding', (t) => {
}
const response = {
code: () => response,
send: send
send
}

function send (body) {
Expand All @@ -189,7 +189,7 @@ test('hook accepts correct header with auth function (promise)', (t) => {
}
const response = {
code: () => response,
send: send
send
}

function send (body) {
Expand All @@ -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) {
Expand All @@ -240,7 +240,7 @@ test('hook rejects wrong token with keys', (t) => {
}
const response = {
code: () => response,
send: send
send
}

function send (body) {
Expand All @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')()
Expand All @@ -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',
Expand Down Expand Up @@ -114,15 +114,15 @@ 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')()
await fastify.register(plugin, { addHook: false, keys: new Set(['123456']) })
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',
Expand Down

0 comments on commit d86d7fd

Please sign in to comment.