feat(dev): update GitPod testing (#40328)

* feat(dev): update GitPod testing
This commit is contained in:
Shaun Hamilton
2020-12-01 13:37:10 +00:00
committed by GitHub
parent f1f6cf8a48
commit 1ef12d5605

View File

@ -13,6 +13,7 @@ describe('getSetAccessToken', () => {
const invalidJWTSecret = 'This is not correct secret'; const invalidJWTSecret = 'This is not correct secret';
const now = new Date(Date.now()); const now = new Date(Date.now());
const theBeginningOfTime = new Date(0); const theBeginningOfTime = new Date(0);
const domain = process.env.COOKIE_DOMAIN || 'localhost';
const accessToken = { const accessToken = {
id: '123abc', id: '123abc',
userId: '456def', userId: '456def',
@ -134,7 +135,7 @@ describe('getSetAccessToken', () => {
expectedJWT, expectedJWT,
{ {
signed: false, signed: false,
domain: 'localhost', domain,
maxAge: accessToken.ttl maxAge: accessToken.ttl
} }
]); ]);
@ -147,37 +148,20 @@ describe('getSetAccessToken', () => {
// expect.assertions(4); // expect.assertions(4);
const req = mockReq(); const req = mockReq();
const res = mockRes(); const res = mockRes();
const jwtOptions = { signed: false, domain };
removeCookies(req, res); removeCookies(req, res);
expect(res.clearCookie.getCall(0).args).toEqual([ expect(res.clearCookie.getCall(0).args).toEqual([
'jwt_access_token', 'jwt_access_token',
{ jwtOptions
signed: false,
domain: 'localhost'
}
]); ]);
expect(res.clearCookie.getCall(1).args).toEqual([ expect(res.clearCookie.getCall(1).args).toEqual([
'access_token', 'access_token',
{ jwtOptions
signed: false,
domain: 'localhost'
}
]);
expect(res.clearCookie.getCall(2).args).toEqual([
'userId',
{
signed: false,
domain: 'localhost'
}
]);
expect(res.clearCookie.getCall(3).args).toEqual([
'_csrf',
{
signed: false,
domain: 'localhost'
}
]); ]);
expect(res.clearCookie.getCall(2).args).toEqual(['userId', jwtOptions]);
expect(res.clearCookie.getCall(3).args).toEqual(['_csrf', jwtOptions]);
}); });
}); });
}); });