How to use the enzyme.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 openshift / console / frontend / __tests__ / components / utils / promise-component.spec.tsx View on Github external
it('sets `inProgress` to true before resolving promise', (done) => {
    let wrapper = shallow();

    const promise = new Promise((resolve) => {
      // expect(wrapper.text()).toEqual('Loading...');
      resolve(42);
      expect(wrapper.find('button').exists()).toBe(true);
      done();
    });

    wrapper = wrapper.setProps({ promise });
    wrapper.find('button').simulate('click');
  });
});
github microsoft / fluent-ui-react / test / specs / commonTests / classNameHelpers.tsx View on Github external
it(`does not add any className when ${bool}`, () => {
      consoleUtil.disableOnce()

      const wrapper = shallow(React.createElement(Component, { ...requiredProps, [propKey]: bool }))

      wrapper.should.not.have.className(className)
      wrapper.should.not.have.className('true')
      wrapper.should.not.have.className('false')

      propValues.forEach(propVal => wrapper.should.not.have.className(propVal.toString()))
    }),
  )
github reactstrap / reactstrap / src / __tests__ / UncontrolledCollapse.spec.js View on Github external
it('should be a Collapse', () => {
    const collapse = shallow(Yo!);

    expect(collapse.type()).toBe(Collapse);
  });
github Sage / carbon / src / components / settings-row / __spec__.js View on Github external
describe("tags on component", () => {
    let wrapper = shallow();

    it('include correct component, element and role data tags', () => {
      rootTagTest(wrapper, 'settings-row', 'bar', 'baz');
    });
  });
});
github commercetools / ui-kit / packages / components / table / src / base-table.spec.js View on Github external
beforeEach(() => {
        props = createTestProps({
          columns: [{ key: '1', isFixed: true }, { key: '2' }],
        });
        wrapper = shallow();
        gridWrapper = shallow(
          wrapper.find(ClassNames).prop('children')({
            css: jest.fn(),
            cx: jest.fn(),
          })
        );
      });
      it('should not pass fixedColumnCount prop to ', () => {
github dremio / dremio-oss / dac / ui / src / components / Forms / wrapSubmitValueMutator-spec.js View on Github external
it('should render with common props without exploding', () => {
    const wrapper = shallow();
    expect(wrapper).to.have.length(1);
    expect(wrapper.props().randomProp).to.be.equal('foo');
  });
github shopgate / pwa / themes / theme-gmd / pages / Product / components / Header / components / Tiers / spec.jsx View on Github external
it('should render nothing when tier prices are not available (field missing)', () => {
      const price = { currency: 'USD' };
      const wrapper = shallow();
      expect(wrapper).toBeEmptyRender();
    });
  });
github cockroachdb / cockroach-gen / pkg / ui / src / views / cluster / containers / events / events.spec.tsx View on Github external
function makeEventBox(
  events: protos.cockroach.server.serverpb.EventsResponse.IEvent[],
  refreshEventsFn: typeof refreshEvents,
) {
  return shallow(
    ,
  );
}