Skip to content

Commit 3d18a55

Browse files
committed
Begin writing component tests
1 parent 067eff9 commit 3d18a55

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

src/react-native.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import React from 'react-native';
22
import createAll from './components/createAll';
33

4-
const { Provider, Connector, provide, connect } = createAll(React);
5-
6-
export { Provider, Connector, provide, connect };
4+
export const { Provider, Connector, provide, connect } = createAll(React);

src/react.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import React from 'react';
22
import createAll from './components/createAll';
33

4-
const { Provider, Connector, provide, connect } = createAll(React);
5-
6-
export { Provider, Connector, provide, connect };
4+
export const { Provider, Connector, provide, connect } = createAll(React);

test/components/Provider.spec.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import expect from 'expect';
2+
import React, { PropTypes } from 'react/addons';
3+
import { createRedux } from '../../src';
4+
import { Provider } from '../../src/react';
5+
6+
const { TestUtils } = React.addons;
7+
const renderer = TestUtils.createRenderer();
8+
9+
describe('React', () => {
10+
describe('Provider', () => {
11+
it.skip('adds Redux to child context', () => {
12+
const redux = createRedux({ test: () => 'test' });
13+
14+
class Child {
15+
static contextTypes = {
16+
redux: PropTypes.object.isRequired
17+
}
18+
19+
render() {
20+
return <div />;
21+
}
22+
}
23+
24+
renderer.render(
25+
<Provider redux={redux}>
26+
{() => <Child />}
27+
</Provider>
28+
);
29+
30+
const result = renderer.getRenderOutput();
31+
32+
expect(result.type).toBe(Child);
33+
});
34+
});
35+
});

0 commit comments

Comments
 (0)