test(api): suppress expected log (#41502)
This commit is contained in:
committed by
GitHub
parent
217bc10160
commit
e9b1247688
@ -1,4 +1,4 @@
|
|||||||
/* global describe expect it */
|
/* global describe expect it jest */
|
||||||
|
|
||||||
const jwt = require('jsonwebtoken');
|
const jwt = require('jsonwebtoken');
|
||||||
|
|
||||||
@ -36,8 +36,9 @@ describe('redirection', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return a default url if the secrets do not match', () => {
|
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(
|
const encryptedReturnTo = jwt.sign(
|
||||||
{ returnTo: validReturnTo },
|
{ returnTo: validReturnTo },
|
||||||
invalidJWTSecret
|
invalidJWTSecret
|
||||||
@ -45,6 +46,8 @@ describe('redirection', () => {
|
|||||||
expect(
|
expect(
|
||||||
getReturnTo(encryptedReturnTo, validJWTSecret, defaultOrigin)
|
getReturnTo(encryptedReturnTo, validJWTSecret, defaultOrigin)
|
||||||
).toStrictEqual(defaultObject);
|
).toStrictEqual(defaultObject);
|
||||||
|
expect(console.log).toHaveBeenCalled();
|
||||||
|
console.log = oldLog;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a default url for unknown origins', () => {
|
it('should return a default url for unknown origins', () => {
|
||||||
|
Reference in New Issue
Block a user