Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina committed Feb 28, 2019
1 parent 0b211c9 commit 365424e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/cookie.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,20 @@ test('cookies get set correctly with millisecond dates', (t) => {
})

test('parses incoming cookies', (t) => {
t.plan(6)
t.plan(6 + 3 * 3)
const fastify = Fastify()
fastify.register(plugin)

// check that it parses the cookies in the onRequest hook
for (let hook of ['preParsing', 'preValidation', 'preHandler']) {
fastify.addHook(hook, (req, reply, done) => {
t.ok(req.cookies)
t.ok(req.cookies.bar)
t.is(req.cookies.bar, 'bar')
done()
})
}

fastify.get('/test2', (req, reply) => {
t.ok(req.cookies)
t.ok(req.cookies.bar)
Expand Down

1 comment on commit 365424e

@jsumners
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.