Skip to content

Commit

Permalink
test(unit-index): fix node@12 incompatibility
Browse files Browse the repository at this point in the history
ServerResponse in node@<14 is not a fluent interface
  • Loading branch information
Xunnamius committed Nov 5, 2021
1 parent 1520c21 commit 6c94b15
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions test/unit-index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,12 @@ describe('::testApiHandler', () => {

await testApiHandler({
handler: (_, res) => {
res
.setHeader(
'Set-Cookie',
serializeCookieHeader('access_token', '1234', { expires: new Date() })
)
.status(200)
.send({});
// ? Node12 does not provide a fluent interface for setHeader
res.setHeader(
'Set-Cookie',
serializeCookieHeader('access_token', '1234', { expires: new Date() })
);
res.status(200).send({});
},
test: async ({ fetch }) => {
expect((await fetch()).status).toBe(200);
Expand All @@ -213,13 +212,11 @@ describe('::testApiHandler', () => {

await testApiHandler({
handler: (_, res) => {
res
.setHeader('Set-Cookie', [
serializeCookieHeader('access_token', '1234', { expires: new Date() }),
serializeCookieHeader('REFRESH_TOKEN', '5678')
])
.status(200)
.send({});
res.setHeader('Set-Cookie', [
serializeCookieHeader('access_token', '1234', { expires: new Date() }),
serializeCookieHeader('REFRESH_TOKEN', '5678')
]);
res.status(200).send({});
},
test: async ({ fetch }) => {
expect((await fetch()).status).toBe(200);
Expand Down

0 comments on commit 6c94b15

Please sign in to comment.