How to use the enzyme/build/index.shallow function in enzyme

To help you get started, we’ve selected a few enzyme examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Bit-Nation / BITNATION-Pangea-mobile / src / PangeaCommonReactNative / __tests__ / UI / SwitchLabeled.js View on Github external
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();
    });
  });
github Bit-Nation / BITNATION-Pangea-mobile / src / PangeaCore / __tests__ / UI / Nations / NationActionButton.js View on Github external
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', () => {
github NervJS / taro / packages / taro-router-rn / __tests__ / RefreshProvider.spec.js View on Github external
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)
  })
github NervJS / taro / packages / taro-router-rn / __tests__ / RefreshProvider.spec.js View on Github external
it('should render success', function () {
    const wrapper = shallow()
    expect(toJson(wrapper)).toMatchSnapshot()
  })
github NervJS / taro / packages / taro-router-rn / __tests__ / RefreshProvider.spec.js View on Github external
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)
  })
github NervJS / taro / packages / taro-router-rn / __tests__ / RefreshProvider.spec.js View on Github external
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)
  })
})