test(api): suppress expected log (#41502)

This commit is contained in:
Oliver Eyton-Williams
2021-03-16 16:53:08 +01:00
committed by GitHub
parent 217bc10160
commit e9b1247688

View File

@ -1,4 +1,4 @@
/* global describe expect it */
/* global describe expect it jest */
const jwt = require('jsonwebtoken');
@ -36,8 +36,9 @@ describe('redirection', () => {
});
it('should return a default url if the secrets do not match', () => {
expect.assertions(1);
const oldLog = console.log;
expect.assertions(2);
console.log = jest.fn();
const encryptedReturnTo = jwt.sign(
{ returnTo: validReturnTo },
invalidJWTSecret
@ -45,6 +46,8 @@ describe('redirection', () => {
expect(
getReturnTo(encryptedReturnTo, validJWTSecret, defaultOrigin)
).toStrictEqual(defaultObject);
expect(console.log).toHaveBeenCalled();
console.log = oldLog;
});
it('should return a default url for unknown origins', () => {