Fix test setup

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2021-05-06 09:14:31 +02:00
parent c7e2a2bd66
commit acac7b1e69
3 changed files with 23 additions and 3 deletions

View File

@ -42,9 +42,10 @@ module.exports = {
BACKEND_URL: 'http://localhost:1337', BACKEND_URL: 'http://localhost:1337',
ADMIN_PATH: '/admin', ADMIN_PATH: '/admin',
NODE_ENV: 'test', NODE_ENV: 'test',
ENABLED_EE_FEATURES: [], 'process.env.STRAPI_ADMIN_ENABLED_EE_FEATURES': [],
STRAPI_ADMIN_SHOW_TUTORIALS: 'false', STRAPI_ADMIN_ENABLED_EE_FEATURES: [],
STRAPI_ADMIN_UPDATE_NOTIFICATION: 'false', 'process.env.STRAPI_ADMIN_SHOW_TUTORIALS': 'false',
'process.env.STRAPI_ADMIN_UPDATE_NOTIFICATION': 'false',
}, },
moduleDirectories: [ moduleDirectories: [
'node_modules', 'node_modules',

View File

@ -1,6 +1,21 @@
import { reducer } from '../reducer'; import { reducer } from '../reducer';
describe('ADMIN | COMPONENTS | USERS | MODALCREATEBODY | reducer', () => { describe('ADMIN | COMPONENTS | USERS | MODALCREATEBODY | reducer', () => {
const OLD_ENV = process.env;
beforeEach(() => {
jest.resetModules();
process.env = {
...OLD_ENV,
IS_EE: false,
'process.env.STRAPI_ADMIN_ENABLED_EE_FEATURES': [],
STRAPI_ADMIN_ENABLED_EE_FEATURES: [],
};
});
afterAll(() => {
process.env = OLD_ENV; // Restore old environment
});
describe('DEFAULT_ACTION', () => { describe('DEFAULT_ACTION', () => {
it('should return the initialState', () => { it('should return the initialState', () => {
const initialState = { const initialState = {

View File

@ -24,6 +24,10 @@ const hoc = () => WrappedComponent => {
return hoistNonReactStatics(HocInjector, WrappedComponent); return hoistNonReactStatics(HocInjector, WrappedComponent);
}; };
// FIXME
global.process.env.STRAPI_ADMIN_ENABLED_EE_FEATURES = [];
global.process.env.ADMIN_PATH = '/admin/';
global.strapi = { global.strapi = {
backendURL: 'http://localhost:1337', backendURL: 'http://localhost:1337',
injectReducer: hoc, injectReducer: hoc,