Skip to content
This repository was archived by the owner on Apr 11, 2019. It is now read-only.

Commit 18de2ba

Browse files
committed
Feat: finish integration of jest as testing util
1 parent 8a57d25 commit 18de2ba

File tree

18 files changed

+234
-242
lines changed

18 files changed

+234
-242
lines changed

app/src/components/Header/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { PropTypes } from 'react';
2-
32
import styles from './index.module.scss';
43
import cssModules from 'react-css-modules';
54

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
exports[`<Header /> should render with default props 1`] = `
2+
<h1>
3+
Hello World
4+
</h1>
5+
`;
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
import Header from '../index';
2-
3-
import expect from 'expect';
42
import { shallow } from 'enzyme';
3+
import { shallowToJson } from 'enzyme-to-json';
54
import React from 'react';
65

76
describe('<Header />', () => {
8-
it('should render an h1 header element with the specified text', () => {
9-
const renderedComponent = shallow(
10-
<Header content="Hello World!" />
7+
it('should render with default props', () => {
8+
const wrapper = shallow(
9+
<Header
10+
content="Hello World"
11+
/>
1112
);
12-
expect(
13-
renderedComponent
14-
.find('h1')
15-
.contains('Hello World!')
16-
).toEqual(true);
13+
expect(shallowToJson(wrapper)).toMatchSnapshot();
1714
});
1815
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
exports[`<Header /> should render with default props 1`] = `
2+
<div>
3+
<img
4+
alt="Udacity Logo"
5+
id="udacity-alumni-logo"
6+
src="https://github.com/RyanCCollins/cdn/blob/master/alumni-webapp/udacity-alumni-png.png?raw=true" />
7+
</div>
8+
`;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { shallow } from 'enzyme';
2+
import React from 'react';
3+
import { shallowToJson } from 'enzyme-to-json';
4+
import LogoImage from '../index';
5+
6+
describe('<Header />', () => {
7+
it('should render with default props', () => {
8+
const wrapper = shallow(
9+
<LogoImage
10+
imageSource="https://github.com/RyanCCollins/cdn/blob/master/alumni-webapp/udacity-alumni-png.png?raw=true"
11+
/>
12+
);
13+
expect(shallowToJson(wrapper)).toMatchSnapshot();
14+
});
15+
});

app/src/components/Navbar/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const Navbar = () => (
2525
<Anchor href="#">
2626
Third
2727
</Anchor>
28-
<Search dropAlign={{"right": "right"}} />
28+
<Search dropAlign={{ right: 'right'}} />
2929
</Menu>
3030
</Header>
3131
</div>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
exports[`<Navbar /> should render with default props 1`] = `
2+
<div>
3+
<Header
4+
align="center"
5+
direction="row"
6+
justify="between"
7+
pad={
8+
Object {
9+
"between": "small",
10+
"horizontal": "none",
11+
"vertical": "none"
12+
}
13+
}
14+
responsive={false}
15+
tag="header">
16+
<Title
17+
responsive={true}>
18+
<img
19+
alt="logo"
20+
src={Object {}} />
21+
</Title>
22+
<Menu
23+
align="center"
24+
closeOnClick={true}
25+
direction="row"
26+
dropAlign={
27+
Object {
28+
"left": "left",
29+
"top": "top"
30+
}
31+
}
32+
pad="none"
33+
responsive={false}>
34+
<Anchor
35+
className="active"
36+
href="#"
37+
tag="a">
38+
First
39+
</Anchor>
40+
<Anchor
41+
href="#"
42+
tag="a">
43+
Second
44+
</Anchor>
45+
<Anchor
46+
href="#"
47+
tag="a">
48+
Third
49+
</Anchor>
50+
<Search
51+
align="left"
52+
dropAlign={
53+
Object {
54+
"right": "right"
55+
}
56+
}
57+
iconAlign="end"
58+
inline={false}
59+
responsive={true} />
60+
</Menu>
61+
</Header>
62+
</div>
63+
`;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { shallow } from 'enzyme';
2+
import React from 'react';
3+
import { shallowToJson } from 'enzyme-to-json';
4+
import Navbar from '../index';
5+
6+
describe('<Navbar />', () => {
7+
it('should render with default props', () => {
8+
const wrapper = shallow(
9+
<Navbar />
10+
);
11+
expect(shallowToJson(wrapper)).toMatchSnapshot();
12+
});
13+
});

app/src/containers/FeatureFirstContainer/reducer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
CLEAR_DATA_ERROR,
66
} from './constants';
77

8-
const initialState = {
8+
export const initialState = {
99
isLoading: false,
1010
data: {},
1111
error: {},
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
exports[`<FeatureFirstContainer /> renders with default props 1`] = `
2+
<FeatureFirstContainer
3+
actions={
4+
Object {
5+
"clearDataError": [Function anonymous],
6+
"loadDataFailure": [Function anonymous],
7+
"loadDataInitiation": [Function anonymous],
8+
"loadDataSuccess": [Function anonymous]
9+
}
10+
}
11+
store={
12+
Object {
13+
"clearActions": [Function clearActions],
14+
"dispatch": [Function anonymous],
15+
"getActions": [Function getActions],
16+
"getState": [Function getState],
17+
"subscribe": [Function subscribe]
18+
}
19+
} />
20+
`;

0 commit comments

Comments
 (0)