Skip to content

Commit aba63cf

Browse files
committed
v0.3.0 - The standard ReactJS server is here
1 parent 1181ff3 commit aba63cf

File tree

20 files changed

+3990
-1101
lines changed

20 files changed

+3990
-1101
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v8.9.4
1+
v8.11.1

__tests__/__snapshots__/index.js.snap

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Exports expected stuff 1`] = `
3+
exports[`Export at client side 1`] = `
4+
Object {
5+
"Avatar": [Function],
6+
"Button": [Function],
7+
"JU": null,
8+
"Link": [Function],
9+
"NavLink": [Function],
10+
"ScalableRect": [Function],
11+
"config": undefined,
12+
"isomorphy": Object {
13+
"buildTimestamp": [Function],
14+
"isClientSide": [Function],
15+
"isDevBuild": [Function],
16+
"isProdBuild": [Function],
17+
"isServerSide": [Function],
18+
},
19+
"server": null,
20+
"webpack": Object {
21+
"default": undefined,
22+
"requireWeak": [Function],
23+
},
24+
}
25+
`;
26+
27+
exports[`Export at server side 1`] = `
428
Object {
529
"Avatar": [Function],
630
"Button": [Function],

__tests__/index.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
jest.mock('utils/isomorphy');
1+
/* global window */
22

3-
const exports = require('../src');
3+
jest.mock('utils/webpack/require');
44

5-
test('Exports expected stuff', () => {
6-
expect(exports).toMatchSnapshot();
5+
beforeEach(() => jest.resetModules());
6+
7+
afterEach(() => delete window.TRU_FRONT_END);
8+
9+
test('Export at client side', () => {
10+
window.TRU_FRONT_END = true;
11+
expect(require('../src')).toMatchSnapshot();
12+
});
13+
14+
test('Export at server side', () => {
15+
expect(require('../src')).toMatchSnapshot();
716
});

__tests__/shared/components/Button.jsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,18 @@ describe('Matches snapshots', () => {
1919
active
2020
onClick={_.noop}
2121
theme={testTheme}
22-
>BUTTON</Button>
22+
>
23+
BUTTON
24+
</Button>
2325
));
2426
shallowSnapshot((
2527
<Button
2628
active
2729
onClick={_.noop}
2830
theme={_.omit(testTheme, 'regular')}
29-
>BUTTON</Button>
31+
>
32+
BUTTON
33+
</Button>
3034
));
3135
});
3236
test('when disabled', () => {
@@ -36,15 +40,19 @@ describe('Matches snapshots', () => {
3640
onClick={_.noop}
3741
theme={testTheme}
3842
size="xl"
39-
>BUTTON</Button>
43+
>
44+
BUTTON
45+
</Button>
4046
));
4147
shallowSnapshot((
4248
<Button
4349
disabled
4450
onClick={_.noop}
4551
theme={_.omit(testTheme, 'disabled')}
4652
size="xl"
47-
>BUTTON</Button>
53+
>
54+
BUTTON
55+
</Button>
4856
));
4957
});
5058
test('when rendered as link', () => {
@@ -53,14 +61,18 @@ describe('Matches snapshots', () => {
5361
active
5462
theme={testTheme}
5563
to="/SOME/TEST/URL"
56-
>BUTTON</Button>
64+
>
65+
BUTTON
66+
</Button>
5767
));
5868
shallowSnapshot((
5969
<Button
6070
active
6171
theme={_.omit(testTheme, 'link')}
6272
to="/SOME/TEST/URL"
63-
>BUTTON</Button>
73+
>
74+
BUTTON
75+
</Button>
6476
));
6577
});
6678
});

__tests__/shared/components/GenericLink.jsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ function Link(props) {
1010
<button
1111
onClick={props.onClick}
1212
className={props.className}
13-
>{JSON.stringify(props)}</button>
13+
>
14+
{JSON.stringify(props)}
15+
</button>
1416
);
1517
}
1618

@@ -29,7 +31,9 @@ describe('Matches snapshots', () => {
2931
<GenericLink
3032
routerLinkType={Link}
3133
to="SOME/TEST/URL"
32-
>LINK</GenericLink>
34+
>
35+
LINK
36+
</GenericLink>
3337
));
3438
});
3539
test('when rendered as <a> element', () => {
@@ -38,14 +42,18 @@ describe('Matches snapshots', () => {
3842
enforceA
3943
routerLinkType={Link}
4044
to="SOME/TEST/URL"
41-
>LINK</GenericLink>
45+
>
46+
LINK
47+
</GenericLink>
4248
));
4349
snapshot((
4450
<GenericLink
4551
openNewTab
4652
routerLinkType={Link}
4753
to="SOME/TEST/URL"
48-
>LINK</GenericLink>
54+
>
55+
LINK
56+
</GenericLink>
4957
));
5058
});
5159
});
@@ -59,7 +67,9 @@ test('onClick(..) works when rendered as custom <Link>', () => {
5967
onClick={clickHandler}
6068
routerLinkType={Link}
6169
to="SOME/TEST/URL"
62-
>LINK</GenericLink>
70+
>
71+
LINK
72+
</GenericLink>
6373
));
6474
let link = findInDomByClass(doc, 'LINK');
6575
simulate.click(link);
@@ -72,7 +82,9 @@ test('onClick(..) works when rendered as custom <Link>', () => {
7282
className="LINK"
7383
routerLinkType={Link}
7484
to={domain}
75-
>LINK</GenericLink>
85+
>
86+
LINK
87+
</GenericLink>
7688
));
7789
link = findInDomByClass(doc, 'LINK');
7890
simulate.click(link);

__tests__/shared/components/Link.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@ import React from 'react';
33
import { shallowSnapshot } from 'utils/jest';
44

55
test('Matches snapshots', () => {
6-
shallowSnapshot((
7-
<Link />
8-
));
6+
shallowSnapshot(<Link />); // eslint-disable-line jsx-a11y/anchor-is-valid
97
});

__tests__/shared/components/ScalableRect.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ test('Snapshots match', () => {
77
snapshot((
88
<ScalableRect
99
className="CLASS_NAME"
10-
>CONTENT</ScalableRect>
10+
>
11+
CONTENT
12+
</ScalableRect>
1113
));
1214
});

0 commit comments

Comments
 (0)