UNPKG

@financial-times/n-conversion-forms

Version:

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

20 lines (16 loc) 582 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) ); 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, }; }, };