How to use the enzyme-to-json function in enzyme-to-json

To help you get started, we’ve selected a few enzyme-to-json 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 robinweser / fela / packages / fela-enzyme / src / felaShallow.js View on Github external
indent: '  ',
      openbrace: 'end-of-line',
      autosemicolon: false,
    }

    let renderer = rootRenderer
    let wrapperToSnapshot = wrapper

    if (includeStyles) {
      // use a new renderer to capture the styles just by rendering this enzyme wrapper
      renderer = createRenderer()
      wrapperToSnapshot = felaDive(wrapper, renderer)
    }

    const result = {
      component: toJson(wrapperToSnapshot),
    }

    if (includeStyles) {
      result.styles = `\n${cssbeautify(renderToString(renderer), options)}\n`
    }

    return result
  }
github nteract / nteract / packages / outputs / __tests__ / media.spec.tsx View on Github external
it("should render urls as links", () => {
    const data = "Let's go to https://google.com today!";
    const component = mount();
    expect(toJson(component)).toMatchSnapshot();
    expect(component.find("a").prop("href")).toEqual("https://google.com");
  });
  it("should render urls on a separate line as links", () => {
github react-native-elements / react-native-elements / src / text / __tests__ / Text.js View on Github external
it('should render without issues', () => {
    const component = shallow(
github NervJS / taro / packages / taro-router-rn / __tests__ / getWrappedScreen.spec.js View on Github external
it('should render success with globalNavigationOptions', function () {
      const wrapper = getShallowWrapper()
      expect(toJson(wrapper)).toMatchSnapshot()
    })
  })
github reactioncommerce / reaction / imports / plugins / core / ui / client / components / translation / __tests__ / translation.js View on Github external
test("Translation snapshot test", () => {
  const component = shallow(
    
  );
  const tree = shallowToJSON(component);
  expect(tree).toMatchSnapshot();
});
github LN-Zap / zap-desktop / test / unit / components / Home / WalletHeader.spec.js View on Github external
it('should render correctly', () => {
    const wallet = {
      type: 'local',
      id: 1,
      host: 'local.host',
      name: 'Wallet name',
    }
    const wrapper = shallow()
    expect(toJSON(wrapper)).toMatchSnapshot()
  })
})
github Kilix / selectless / src / __tests__ / components / label.js View on Github external
it('Label', () => {
  const fn = jest.fn()
  const ctx = {
    opened: false,
    placeholder: 'Lavel',
    selectedValue: [],
    toggleSelect: fn,
  }
  const tree = mount(<label>, {context: ctx})
  expect(toJson(tree)).toMatchSnapshot()
})
it('have value', () =&gt; {</label>
github getsentry / sentry / tests / js / spec / components / eventOrGroupExtraDetails.spec.jsx View on Github external
it('renders only last seen', function() {
    const component = shallow(
      
    );

    expect(toJson(component)).toMatchSnapshot();
  });
github LN-Zap / zap-desktop / test / unit / components / Pay / PayAddressField.spec.js View on Github external
it('should render correctly', () =&gt; {
      const wrapper = shallow()
      expect(toJSON(wrapper)).toMatchSnapshot()
    })
  })
github neos / neos-ui / packages / react-ui-components / src / TextInput / textInput.spec.js View on Github external
it('should render correctly.', () =&gt; {
        const wrapper = shallow();

        expect(toJson(wrapper)).toMatchSnapshot();
    });

enzyme-to-json

convert enzyme wrapper to a format compatible with Jest snapshot

MIT
Latest version published 3 years ago

Package Health Score

74 / 100
Full package analysis