How to use the enzyme/build.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 cern-phone-apps / desktop-phone-app / src / old_tests / calls / components / call_modals / OutgoingCallModal / OutgoingCallModal.js View on Github external
it("can cancel a call", () => {
    const hangUpCurrentCallAction = jest.fn();

    const phoneNumber = "123456";
    const caller = "John Doe";
    const phoneService = {
      hangUpCurrentCallAction: hangUpCurrentCallAction
    };

    const wrapper = shallow(
       key}
      />
    );

    const div = wrapper.find(".HangupButton");
    div.simulate("click");

    expect(hangUpCurrentCallAction).toHaveBeenCalled();
  });
});
github mytardis / mytardis / assets / js / apps / search / __tests__ / search.spec.jsx View on Github external
it('Render Search Component', () => {
    const search = shallow();
    expect(search.exists()).toBeTruthy();
  });
});
github mytardis / mytardis / assets / js / apps / search / __tests__ / search.spec.jsx View on Github external
it('Test Render Result component', () => {
    const experimentResultComponent = shallow(
      ,
    );
    expect(experimentResultComponent.exists()).toBeTruthy();
    const datasetResultComponent = shallow(
      ,
    );
    expect(datasetResultComponent.exists()).toBeTruthy();
    const datafileResultComponent = shallow(
      ,
    );
    expect(datafileResultComponent.exists()).toBeTruthy();
  });
  it('Test Render Simple Search Form', () => {
github mytardis / mytardis / assets / js / apps / search / __tests__ / search.spec.jsx View on Github external
it('Render Results Component', () => {
    const data = JSON.parse(apiResponse);
    expect(data).toBeTruthy();
    let newResults = [];
    newResults = createExperimentResultData(data.objects[0].hits.experiments, newResults);
    expect(newResults).toBeTruthy();
    newResults = createDatasetResultData(data.objects[0].hits.datasets, newResults);
    expect(newResults).toBeTruthy();
    newResults = createDataFileResultData(data.objects[0].hits.datafiles, newResults);
    expect(newResults).toBeTruthy();
    const _counts = {
      experimentsCount: 0,
      datasetsCount: 0,
      datafilesCount: 0,
    };
    const results = shallow();
    expect(results).toBeTruthy();
  });
});
github mytardis / mytardis / assets / js / apps / search / __tests__ / search.spec.jsx View on Github external
it('Test Render Result component', () => {
    const experimentResultComponent = shallow(
      ,
    );
    expect(experimentResultComponent.exists()).toBeTruthy();
    const datasetResultComponent = shallow(
      ,
    );
    expect(datasetResultComponent.exists()).toBeTruthy();
    const datafileResultComponent = shallow(
      ,
    );
    expect(datafileResultComponent.exists()).toBeTruthy();
  });
  it('Test Render Simple Search Form', () => {
github mytardis / mytardis / assets / js / apps / search / __tests__ / search.spec.jsx View on Github external
it('Test Render Result component', () => {
    const experimentResultComponent = shallow(
      ,
    );
    expect(experimentResultComponent.exists()).toBeTruthy();
    const datasetResultComponent = shallow(
      ,
    );
    expect(datasetResultComponent.exists()).toBeTruthy();
    const datafileResultComponent = shallow(
      ,
    );
    expect(datafileResultComponent.exists()).toBeTruthy();
  });
  it('Test Render Simple Search Form', () => {
github mytardis / mytardis / assets / js / apps / search / __tests__ / search.spec.jsx View on Github external
it('Test Render Simple Search Form', () => {
    const simpleSearchForm = shallow();
    expect(simpleSearchForm).toBeTruthy();
  });
  it('Test Render Advanced Search Form', () => {
github cern-phone-apps / desktop-phone-app / src / old_tests / calls / components / call_modals / OutgoingCallModal / OutgoingCallModal.js View on Github external
it("contains Texts", () => {
    const phoneNumber = "123456";
    const caller = "John Doe";
    const wrapper = shallow(
       key}
      />
    );

    expect(wrapper.debug()).toContain("ModalContent");
    expect(wrapper.debug()).toContain("callingText");
    expect(wrapper.debug()).toContain("phone");
    expect(wrapper.debug()).toContain(phoneNumber);
    expect(wrapper.debug()).toContain(caller);
  });
github react-native-elements / react-native-elements / src / swiper / __tests__ / Controls.js View on Github external
it('should slide to next by button click', () => {
      const onPress = jest.fn();

      const component = shallow(
        
      );
      const next = component.instance()._renderNext();
      next.props.onPress();

      expect(onPress).toHaveBeenCalled();
    });
github mytardis / mytardis / assets / js / apps / search / __tests__ / search.spec.jsx View on Github external
it('Test Render Advanced Search Form', () => {
    const advanceSearchForm = shallow(
      ,
    );
    expect(advanceSearchForm).toBeTruthy();
  });
});