Move getClientConfig setup to tests/setup
This commit is contained in:
Родитель
bce3361b2c
Коммит
4caa35aa2b
|
@ -1,17 +1,3 @@
|
|||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
require('babel-register');
|
||||
|
||||
const config = require('config');
|
||||
|
||||
function getClientConfig(_config) {
|
||||
const clientConfig = {};
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const key of _config.get('clientConfigKeys')) {
|
||||
clientConfig[key] = _config.get(key);
|
||||
}
|
||||
return clientConfig;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
coveragePathIgnorePatterns: [
|
||||
'<rootDir>/node_modules/',
|
||||
|
@ -19,9 +5,6 @@ module.exports = {
|
|||
'<rootDir>/tests/',
|
||||
'<rootDir>/config/',
|
||||
],
|
||||
globals: {
|
||||
CLIENT_CONFIG: getClientConfig(config),
|
||||
},
|
||||
moduleDirectories: [
|
||||
'src',
|
||||
'node_modules',
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'babel-polyfill';
|
||||
import sinon from 'sinon';
|
||||
import { assert } from 'chai';
|
||||
import config from 'config';
|
||||
import areIntlLocalesSupported from 'intl-locales-supported';
|
||||
|
||||
class LocalStorageMock {
|
||||
|
@ -67,6 +68,8 @@ global.sinon = realSinon.sandbox.create();
|
|||
global.sinon.createStubInstance = realSinon.createStubInstance;
|
||||
global.sinon.format = realSinon.format;
|
||||
global.sinon.assert = realSinon.assert;
|
||||
// Stub the magic constant webpack normally supplies.
|
||||
global.CLIENT_CONFIG = require('core/utils').getClientConfig(config);
|
||||
|
||||
afterEach(() => {
|
||||
global.sinon.restore();
|
||||
|
|
Загрузка…
Ссылка в новой задаче