Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('SwitchLabeled change of value', () => {
const onValueChange = jest.fn();
const wrapper = shallow();
const render = wrapper.dive();
render.find('Switch').forEach((child) => {
child.simulate('valueChange');
});
expect(onValueChange).toBeCalled();
});
});
test('NationActionButton press disabled', () => {
const onPress = jest.fn();
const wrapper = shallow();
expect(wrapper).toMatchSnapshot();
const render = wrapper.dive();
expect(render.find(TouchableOpacity).props().disabled).toBeTruthy();
});
test('NationActionButton press enabled', () => {
it('should call handleReachBottom success', function () {
const mockCallback = jest.fn()
const wrapper = shallow()
wrapper.setProps({ onReachBottom: mockCallback })
wrapper.instance().handleReachBottom()
expect(mockCallback.mock.calls.length).toBe(1)
})
it('should render success', function () {
const wrapper = shallow()
expect(toJson(wrapper)).toMatchSnapshot()
})
it('should call handlePullDownRefresh success', function (done) {
const mockCallback = jest.fn()
const wrapper = shallow()
wrapper.setProps({ onPullDownRefresh: mockCallback })
function callback (data) {
expect(wrapper.state().refreshing).toBe(true)
done()
}
wrapper.instance().handlePullDownRefresh(callback)
expect(mockCallback.mock.calls.length).toBe(1)
})
it('should call stopPullDownRefresh success', function (done) {
const wrapper = shallow()
function callback (data) {
expect(wrapper.state().refreshing).toBe(false)
done()
}
wrapper.setState({ refreshing: true })
wrapper.instance().stopPullDownRefresh(callback)
})
})