UNPKG

@financial-times/n-conversion-forms

Version:

Containing jsx components and styles for forms included on Accounts and Acquisition apps (next-signup, next-profile, next-retention, etc).

21 lines (17 loc) 638 B
import ReactDOMServer from 'react-dom/server'; export const expectToRenderCorrectly = { toRenderCorrectly(reactComponent, props) { // Render the React component with props. const ReactComponentRendered = ReactDOMServer.renderToStaticMarkup( reactComponent(props) ); // eslint-disable-next-line jest/no-standalone-expect expect(ReactComponentRendered).toMatchSnapshot(); // This point is reached when the above assertions were successful. // The test should therefore always pass, that means it needs to be // `true` when used normally, and `false` when `.not` was used. return { pass: !this.isNot, }; }, };