Skip to content

Commit 76d8c39

Browse files
committed
FIX: Some imports / exports had wrong syntax, not supported by Babel 7
1 parent c7cb64a commit 76d8c39

File tree

7 files changed

+1940
-5232
lines changed

7 files changed

+1940
-5232
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
### V0.9.0
44
- NodeJS updated to the latest LTS version (10.14.2);
55
- NPM dependencies updated to the latest versions. In particular:
6-
- Babel updated from v6 to v7.
6+
- Babel updated from v6 to v7;
7+
- Misc related fixes.
78

89
### v0.8.2
910
- Adds [**`Modal`**](docs/modal.md) component.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Base test 1`] = `
4+
Config {
5+
"SECRET": Object {
6+
"dummySecretKey": "Dummy Secret Value",
7+
},
8+
"dummyKey": "Dummy Value",
9+
}
10+
`;

__tests__/shared/utils/config.js

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
11
/* eslint-env browser */
22

33
import _ from 'lodash';
4+
import config from 'config';
45
import { isClientSide, isServerSide } from 'utils/isomorphy';
56

6-
const CLIENT_SIDE_CONFIG = {
7-
TYPE: 'CLIENT_SIDE_CONFIG',
8-
};
9-
10-
const SERVER_SIDE_CONFIG = {
11-
TYPE: 'SERVER_SIDE_CONFIG',
12-
};
13-
14-
jest.setMock('config', _.clone(SERVER_SIDE_CONFIG));
15-
16-
beforeEach(() => {
17-
jest.resetModules();
18-
window.CONFIG = _.clone(CLIENT_SIDE_CONFIG);
19-
});
20-
21-
afterEach(() => delete window.TRU_FRONT_END);
22-
23-
test('Serves injected config at the client side', () => {
24-
window.TRU_FRONT_END = true;
25-
expect(isClientSide()).toBe(true);
26-
expect(require('utils/config')).toEqual(CLIENT_SIDE_CONFIG);
7+
test('Base test', () => {
8+
expect(config).toMatchSnapshot();
279
});
2810

29-
test('Serves node-config at the server side', () => {
30-
expect(isServerSide()).toBe(true);
31-
expect(require('utils/config')).toEqual(SERVER_SIDE_CONFIG);
11+
describe('Isomorphy behavior tests', () => {
12+
const CLIENT_SIDE_CONFIG = {
13+
TYPE: 'CLIENT_SIDE_CONFIG',
14+
};
15+
16+
const SERVER_SIDE_CONFIG = {
17+
TYPE: 'SERVER_SIDE_CONFIG',
18+
};
19+
20+
beforeEach(() => {
21+
jest.resetModules();
22+
jest.setMock('config', _.clone(SERVER_SIDE_CONFIG));
23+
window.CONFIG = _.clone(CLIENT_SIDE_CONFIG);
24+
});
25+
26+
afterEach(() => delete window.TRU_FRONT_END);
27+
28+
test('Serves injected config at the client side', () => {
29+
window.TRU_FRONT_END = true;
30+
expect(isClientSide()).toBe(true);
31+
expect(require('utils/config').default).toEqual(CLIENT_SIDE_CONFIG);
32+
});
33+
34+
test('Serves node-config at the server side', () => {
35+
expect(isServerSide()).toBe(true);
36+
expect(require('utils/config').default).toEqual(SERVER_SIDE_CONFIG);
37+
});
3238
});

0 commit comments

Comments
 (0)