UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

60 lines (59 loc) 1.5 kB
import { screen as a } from "@testing-library/react"; expect.extend({ toHaveBeenRendered(t) { try { expect(t).toHaveBeenCalled(); } catch (s) { return { pass: !1, message: () => `Component was not rendered: ${s.message}` }; } return { pass: !0, message: () => "Component was rendered" }; }, toHaveBeenRenderedWithProps(t, s, e) { try { expect(t).toHaveBeenCalledWith(s, void 0); } catch (r) { return { pass: !1, message: () => `Component was not rendered with expected props: ${r.message}` }; } if (e?.testId) try { a.getByTestId(e.testId); } catch (r) { return { pass: !1, message: () => `Component was rendered with expected props but element with testId "${e.testId}" was not found in the DOM: ${r.message}` }; } return { pass: !0, message: () => "Component was rendered with expected props" + (e?.testId ? " and found in DOM" : "") }; }, toHaveBeenLastRenderedWithProps(t, s) { try { expect(t).toHaveBeenLastCalledWith(s, void 0); } catch (e) { return { pass: !1, message: () => `Component was not last rendered with expected props: ${e.message}` }; } return { pass: !0, message: () => "Component was last rendered with expected props" }; } }); //# sourceMappingURL=ComponentToBePassedPropsCustomMatcher.js.map