-
-
Notifications
You must be signed in to change notification settings - Fork 429
/
App.tests.tsx
32 lines (26 loc) · 929 Bytes
/
App.tests.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React from 'react';
import TestUtils from 'react-addons-test-utils';
import App from '../../src/components/App';
import WhoToGreet from '../../src/components/WhoToGreet';
import Greeting from '../../src/components/Greeting';
import GreetingStore from '../../src/stores/GreetingStore';
describe('App', () => {
it('renders expected HTML', () => {
const app = render({ greetings: ['James'], newGreeting: 'Benjamin' });
expect(app).toEqual(
<div className="container-fluid">
<h1>Hello People!</h1>
<WhoToGreet newGreeting={ 'Benjamin' } />
{ [
<Greeting key={ 0 } targetOfGreeting="James" />
] }
</div>
);
});
function render(state: any) {
const shallowRenderer = TestUtils.createRenderer();
spyOn(GreetingStore, 'getState').and.returnValue(state);
shallowRenderer.render(<App />);
return shallowRenderer.getRenderOutput();
}
});