Skip to content

Commit

Permalink
test: add test to reproduce regression
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed May 21, 2021
1 parent b4c2dec commit 3ac1567
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1222,4 +1222,39 @@ test.group('Server | all', (group) => {
const { body } = await supertest(httpServer).get('/users/1').expect(200)
assert.deepEqual(body, { matchesRoute: true })
})

/**
* Reproducing regression
*/
test('find if the signed url signature is valid', async (assert) => {
const app = await setupApp()
const server = new Server(
app,
encryption,
Object.assign({}, serverConfig, {
forceContentNegotiationToJSON: true,
})
)

const httpServer = createServer(server.handle.bind(server))
server.router
.get('/users/:id', async ({ request }) => {
return {
hasValidSignature: request.hasValidSignature(),
}
})
.as('showUser')

server.optimize()

/**
* Make a signed url
*/
const url = server.router.makeSignedUrl('showUser', [1], {
qs: { site: 1, db: 'pg', dbUser: 1 },
})

const { body } = await supertest(httpServer).get(url).expect(200)
assert.deepEqual(body, { hasValidSignature: true })
})
})

0 comments on commit 3ac1567

Please sign in to comment.