-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from just4fun/unit-testing
Unit testing infrastructure
- Loading branch information
Showing
5 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"presets": [ | ||
"react-native" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { | ||
View, | ||
Text, | ||
StyleSheet | ||
} from 'react-native'; | ||
import Content from '../../src/components/Content'; | ||
import { shallow } from 'enzyme'; | ||
import { expect } from 'chai'; | ||
|
||
describe('<Content />', () => { | ||
it('should render child components as many as `content` length', () => { | ||
let content = [ | ||
{ | ||
infor: '书念得少,不会说什么有文化的祝福。', | ||
type: 0 | ||
}, | ||
{ | ||
infor: '在这里先祝大家鸡年大吉吧。', | ||
type: 0 | ||
} | ||
]; | ||
let wrapper = shallow(<Content content={content} />); | ||
expect(wrapper.find(Text)).to.have.length(2); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// certain features such as ES6 modules are not yet supported in Node, | ||
// when we add a module which uses ES6 import statements, we should use | ||
// babel to compile them. | ||
// | ||
// http://stackoverflow.com/a/35045012/2798001 | ||
require('babel-register')({ | ||
ignore: /node_modules\/(?!react-native-image-progress|react-native-progress)/ | ||
}); |