-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93414f9
commit 55218bc
Showing
5 changed files
with
83 additions
and
14 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,4 @@ | ||
{ | ||
"presets": ["react-native"], | ||
"ignore": false | ||
} |
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,39 @@ | ||
import mockery from 'mockery'; | ||
import m from 'module'; | ||
|
||
// inject __DEV__ as it is not available when running through the tests | ||
global.__DEV__ = true; | ||
|
||
// We enable mockery and leave it on. | ||
mockery.enable(); | ||
|
||
// Silence the warnings when *real* modules load... this is a change from | ||
// the norm. We want to opt-in instead of opt-out because not everything | ||
// will be mocked. | ||
mockery.warnOnUnregistered(false); | ||
|
||
// Mock any libs that get called in here | ||
// I'm looking at you react-native-router-flux, reactotron etc! | ||
mockery.registerMock('reactotron-react-native', {}); | ||
mockery.registerMock('reactotron-redux', {}); | ||
mockery.registerMock('reactotron-apisauce', {}); | ||
mockery.registerMock('react-native-animatable', { View: 'Animatable.View' }); | ||
mockery.registerMock('react-native-vector-icons/Ionicons', {}); | ||
|
||
// mock i18n as it uses react native stufff | ||
mockery.registerMock('react-native-i18n', { | ||
t: key => key, | ||
}); | ||
|
||
mockery.registerMock('react-native-router-flux', {}); | ||
|
||
|
||
// Mock all images for React Native | ||
const originalLoader = m._load; | ||
m._load = (request, parent, isMain) => { | ||
if (request.match(/.jpeg|.jpg|.png|.gif$/)) { | ||
return { uri: request }; | ||
} | ||
|
||
return originalLoader(request, parent, isMain); | ||
}; |
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,27 @@ | ||
import React from 'react'; | ||
|
||
import test from 'ava'; | ||
import { shallow } from 'enzyme'; | ||
import WheelPicker from '../WheelPicker'; | ||
const wrapper = shallow(<WheelPicker />); | ||
|
||
test('component exists', (t) => { | ||
t.is(wrapper.length, 1); // exists | ||
}); | ||
|
||
test('component structure', (t) => { | ||
t.is(wrapper.name(), 'WheelPicker'); // the right root component | ||
t.is(wrapper.children().length, 0); // has 1 child | ||
}); | ||
|
||
test('data', (t) => { | ||
const data = [1, 2, 3]; | ||
const wrapperPress = shallow(<WheelPicker isCyclic={false} isCurved isAtmospheric visibleItemCount={4} backgroundColor={'black'} data={data} />); | ||
|
||
t.is(wrapperPress.prop('data').length, 3); | ||
t.is(wrapperPress.prop('isCurved'), true); | ||
t.is(wrapperPress.prop('isAtmospheric'), true); | ||
t.is(wrapperPress.prop('isCyclic'), false); | ||
t.is(wrapperPress.prop('visibleItemCount'), 4); | ||
t.is(wrapperPress.prop('backgroundColor'), 'black'); | ||
}); |
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 was deleted.
Oops, something went wrong.