chore(deps): update dependency jest to v27

This commit is contained in:
Renovate Bot 2021-07-06 10:28:51 +00:00 committed by Mrugesh Mohapatra
parent fb3e9ef420
commit 7c2a4aff6e
No known key found for this signature in database
GPG Key ID: 68BDF41E23F50DD8
8 changed files with 2911 additions and 2402 deletions

View File

@ -339,7 +339,7 @@ describe('boot/challenge', () => {
});
const mockNormalizeParams = params => params;
it('redirects to the learn base url for non-users', async done => {
it('redirects to the learn base url for non-users', async () => {
const redirectToCurrentChallenge = createRedirectToCurrentChallenge(
() => {},
mockNormalizeParams,
@ -351,11 +351,10 @@ describe('boot/challenge', () => {
await redirectToCurrentChallenge(req, res, next);
expect(res.redirect).toHaveBeenCalledWith(mockLearnUrl);
done();
});
// eslint-disable-next-line max-len
it('redirects to the url provided by the challengeUrlResolver', async done => {
it('redirects to the url provided by the challengeUrlResolver', async () => {
const challengeUrlResolver = await createChallengeUrlResolver(
mockAllChallenges,
{
@ -376,11 +375,10 @@ describe('boot/challenge', () => {
await redirectToCurrentChallenge(req, res, next);
expect(res.redirect).toHaveBeenCalledWith(expectedUrl);
done();
});
// eslint-disable-next-line max-len
it('redirects to the first challenge for users without a currentChallengeId', async done => {
it('redirects to the first challenge for users without a currentChallengeId', async () => {
const challengeUrlResolver = await createChallengeUrlResolver(
mockAllChallenges,
{
@ -400,7 +398,6 @@ describe('boot/challenge', () => {
await redirectToCurrentChallenge(req, res, next);
const expectedUrl = `${mockHomeLocation}${firstChallengeUrl}`;
expect(res.redirect).toHaveBeenCalledWith(expectedUrl);
done();
});
});
});

View File

@ -152,7 +152,7 @@ describe('request-authorization', () => {
expect(next).not.toHaveBeenCalled();
});
it('adds the user to the request object', async done => {
it('adds the user to the request object', async () => {
expect.assertions(3);
const validJWT = jwt.sign({ accessToken }, validJWTSecret);
const req = mockReq({
@ -166,10 +166,9 @@ describe('request-authorization', () => {
expect(next).toHaveBeenCalled();
expect(req).toHaveProperty('user');
expect(req.user).toEqual(users['456def']);
return done();
});
it('adds the jwt to the headers', async done => {
it('adds the jwt to the headers', async () => {
const validJWT = jwt.sign({ accessToken }, validJWTSecret);
const req = mockReq({
path: '/some-path/that-needs/auth',
@ -180,7 +179,6 @@ describe('request-authorization', () => {
const next = jest.fn();
await requestAuthorization(req, res, next);
expect(res.set).toHaveBeenCalledWith('X-fcc-access-token', validJWT);
return done();
});
it('calls next if request does not require authorization', async () => {
@ -240,7 +238,7 @@ describe('request-authorization', () => {
expect(next).not.toHaveBeenCalled();
});
it('adds the user to the request object', async done => {
it('adds the user to the request object', async () => {
expect.assertions(3);
const validJWT = jwt.sign({ accessToken }, validJWTSecret);
const req = mockReq({
@ -253,10 +251,9 @@ describe('request-authorization', () => {
expect(next).toHaveBeenCalled();
expect(req).toHaveProperty('user');
expect(req.user).toEqual(users['456def']);
return done();
});
it('adds the jwt to the headers', async done => {
it('adds the jwt to the headers', async () => {
const validJWT = jwt.sign({ accessToken }, validJWTSecret);
const req = mockReq({
path: '/some-path/that-needs/auth',
@ -267,7 +264,6 @@ describe('request-authorization', () => {
const next = jest.fn();
await requestAuthorization(req, res, next);
expect(res.set).toHaveBeenCalledWith('X-fcc-access-token', validJWT);
return done();
});
it('calls next if request does not require authorization', async () => {

View File

@ -593,7 +593,7 @@ describe('user stats', () => {
it('resolves a user for a given id', done => {
expect.assertions(7);
return getUserById(mockUserID, mockApp.models.User)
getUserById(mockUserID, mockApp.models.User)
.then(user => {
expect(user).toEqual(mockUser);

View File

@ -1,3 +1,7 @@
/**
* @jest-environment node
*/
import createWorker from './worker-executor';
function mockWorker({ init, postMessage, terminate } = {}) {

View File

@ -21,5 +21,6 @@ module.exports = {
},
roots: ['.', './client', './api-server'],
transformIgnorePatterns: ['node_modules/(?!(gatsby)/)'],
setupFilesAfterEnv: ['./jest.setup.js']
setupFilesAfterEnv: ['./jest.setup.js'],
testEnvironment: 'jsdom'
};

View File

@ -12,4 +12,6 @@ const babelOptions = {
]
};
module.exports = require('babel-jest').createTransformer(babelOptions);
// TODO: is there a way to do this without a separate transform? i.e. can we
// just use the existing config?
module.exports = require('babel-jest').default.createTransformer(babelOptions);

5275
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -126,7 +126,7 @@
"eslint-plugin-testing-library": "4.8.0",
"execa": "5.1.1",
"husky": "7.0.1",
"jest": "26.6.3",
"jest": "27.0.6",
"js-yaml": "3.14.1",
"lerna": "4.0.0",
"lint-staged": "11.0.0",
@ -142,4 +142,4 @@
"typescript": "4.3.5",
"webpack-bundle-analyzer": "4.4.2"
}
}
}