chore(deps): update dependency jest to v27
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
fb3e9ef420
commit
7c2a4aff6e
@ -339,7 +339,7 @@ describe('boot/challenge', () => {
|
|||||||
});
|
});
|
||||||
const mockNormalizeParams = params => params;
|
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(
|
const redirectToCurrentChallenge = createRedirectToCurrentChallenge(
|
||||||
() => {},
|
() => {},
|
||||||
mockNormalizeParams,
|
mockNormalizeParams,
|
||||||
@ -351,11 +351,10 @@ describe('boot/challenge', () => {
|
|||||||
await redirectToCurrentChallenge(req, res, next);
|
await redirectToCurrentChallenge(req, res, next);
|
||||||
|
|
||||||
expect(res.redirect).toHaveBeenCalledWith(mockLearnUrl);
|
expect(res.redirect).toHaveBeenCalledWith(mockLearnUrl);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
// 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(
|
const challengeUrlResolver = await createChallengeUrlResolver(
|
||||||
mockAllChallenges,
|
mockAllChallenges,
|
||||||
{
|
{
|
||||||
@ -376,11 +375,10 @@ describe('boot/challenge', () => {
|
|||||||
await redirectToCurrentChallenge(req, res, next);
|
await redirectToCurrentChallenge(req, res, next);
|
||||||
|
|
||||||
expect(res.redirect).toHaveBeenCalledWith(expectedUrl);
|
expect(res.redirect).toHaveBeenCalledWith(expectedUrl);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
// 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(
|
const challengeUrlResolver = await createChallengeUrlResolver(
|
||||||
mockAllChallenges,
|
mockAllChallenges,
|
||||||
{
|
{
|
||||||
@ -400,7 +398,6 @@ describe('boot/challenge', () => {
|
|||||||
await redirectToCurrentChallenge(req, res, next);
|
await redirectToCurrentChallenge(req, res, next);
|
||||||
const expectedUrl = `${mockHomeLocation}${firstChallengeUrl}`;
|
const expectedUrl = `${mockHomeLocation}${firstChallengeUrl}`;
|
||||||
expect(res.redirect).toHaveBeenCalledWith(expectedUrl);
|
expect(res.redirect).toHaveBeenCalledWith(expectedUrl);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -152,7 +152,7 @@ describe('request-authorization', () => {
|
|||||||
expect(next).not.toHaveBeenCalled();
|
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);
|
expect.assertions(3);
|
||||||
const validJWT = jwt.sign({ accessToken }, validJWTSecret);
|
const validJWT = jwt.sign({ accessToken }, validJWTSecret);
|
||||||
const req = mockReq({
|
const req = mockReq({
|
||||||
@ -166,10 +166,9 @@ describe('request-authorization', () => {
|
|||||||
expect(next).toHaveBeenCalled();
|
expect(next).toHaveBeenCalled();
|
||||||
expect(req).toHaveProperty('user');
|
expect(req).toHaveProperty('user');
|
||||||
expect(req.user).toEqual(users['456def']);
|
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 validJWT = jwt.sign({ accessToken }, validJWTSecret);
|
||||||
const req = mockReq({
|
const req = mockReq({
|
||||||
path: '/some-path/that-needs/auth',
|
path: '/some-path/that-needs/auth',
|
||||||
@ -180,7 +179,6 @@ describe('request-authorization', () => {
|
|||||||
const next = jest.fn();
|
const next = jest.fn();
|
||||||
await requestAuthorization(req, res, next);
|
await requestAuthorization(req, res, next);
|
||||||
expect(res.set).toHaveBeenCalledWith('X-fcc-access-token', validJWT);
|
expect(res.set).toHaveBeenCalledWith('X-fcc-access-token', validJWT);
|
||||||
return done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('calls next if request does not require authorization', async () => {
|
it('calls next if request does not require authorization', async () => {
|
||||||
@ -240,7 +238,7 @@ describe('request-authorization', () => {
|
|||||||
expect(next).not.toHaveBeenCalled();
|
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);
|
expect.assertions(3);
|
||||||
const validJWT = jwt.sign({ accessToken }, validJWTSecret);
|
const validJWT = jwt.sign({ accessToken }, validJWTSecret);
|
||||||
const req = mockReq({
|
const req = mockReq({
|
||||||
@ -253,10 +251,9 @@ describe('request-authorization', () => {
|
|||||||
expect(next).toHaveBeenCalled();
|
expect(next).toHaveBeenCalled();
|
||||||
expect(req).toHaveProperty('user');
|
expect(req).toHaveProperty('user');
|
||||||
expect(req.user).toEqual(users['456def']);
|
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 validJWT = jwt.sign({ accessToken }, validJWTSecret);
|
||||||
const req = mockReq({
|
const req = mockReq({
|
||||||
path: '/some-path/that-needs/auth',
|
path: '/some-path/that-needs/auth',
|
||||||
@ -267,7 +264,6 @@ describe('request-authorization', () => {
|
|||||||
const next = jest.fn();
|
const next = jest.fn();
|
||||||
await requestAuthorization(req, res, next);
|
await requestAuthorization(req, res, next);
|
||||||
expect(res.set).toHaveBeenCalledWith('X-fcc-access-token', validJWT);
|
expect(res.set).toHaveBeenCalledWith('X-fcc-access-token', validJWT);
|
||||||
return done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('calls next if request does not require authorization', async () => {
|
it('calls next if request does not require authorization', async () => {
|
||||||
|
@ -593,7 +593,7 @@ describe('user stats', () => {
|
|||||||
|
|
||||||
it('resolves a user for a given id', done => {
|
it('resolves a user for a given id', done => {
|
||||||
expect.assertions(7);
|
expect.assertions(7);
|
||||||
return getUserById(mockUserID, mockApp.models.User)
|
getUserById(mockUserID, mockApp.models.User)
|
||||||
.then(user => {
|
.then(user => {
|
||||||
expect(user).toEqual(mockUser);
|
expect(user).toEqual(mockUser);
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* @jest-environment node
|
||||||
|
*/
|
||||||
|
|
||||||
import createWorker from './worker-executor';
|
import createWorker from './worker-executor';
|
||||||
|
|
||||||
function mockWorker({ init, postMessage, terminate } = {}) {
|
function mockWorker({ init, postMessage, terminate } = {}) {
|
||||||
|
@ -21,5 +21,6 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
roots: ['.', './client', './api-server'],
|
roots: ['.', './client', './api-server'],
|
||||||
transformIgnorePatterns: ['node_modules/(?!(gatsby)/)'],
|
transformIgnorePatterns: ['node_modules/(?!(gatsby)/)'],
|
||||||
setupFilesAfterEnv: ['./jest.setup.js']
|
setupFilesAfterEnv: ['./jest.setup.js'],
|
||||||
|
testEnvironment: 'jsdom'
|
||||||
};
|
};
|
||||||
|
@ -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);
|
||||||
|
5231
package-lock.json
generated
5231
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -126,7 +126,7 @@
|
|||||||
"eslint-plugin-testing-library": "4.8.0",
|
"eslint-plugin-testing-library": "4.8.0",
|
||||||
"execa": "5.1.1",
|
"execa": "5.1.1",
|
||||||
"husky": "7.0.1",
|
"husky": "7.0.1",
|
||||||
"jest": "26.6.3",
|
"jest": "27.0.6",
|
||||||
"js-yaml": "3.14.1",
|
"js-yaml": "3.14.1",
|
||||||
"lerna": "4.0.0",
|
"lerna": "4.0.0",
|
||||||
"lint-staged": "11.0.0",
|
"lint-staged": "11.0.0",
|
||||||
|
Reference in New Issue
Block a user