From 990d5ec5af9cea56812e952c3155a346876621cb Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Thu, 19 Apr 2018 11:16:53 -0400 Subject: custom assertion --- frontend/jest.setup.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'frontend/jest.setup.js') diff --git a/frontend/jest.setup.js b/frontend/jest.setup.js index 82edfc9..1783f17 100644 --- a/frontend/jest.setup.js +++ b/frontend/jest.setup.js @@ -2,3 +2,16 @@ import { configure } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; configure({ adapter: new Adapter() }); + +expect.extend({ + toBeCalledWithVariables(received, argument) { + const receivedVariables = received.mock.calls[0][0].variables; + const pass = this.equals(receivedVariables, argument); + const message = () => + `expected ${this.utils.printExpected(argument)} to match ${this.utils.printReceived( + receivedVariables + )}`; + + return { message, pass }; + }, +}); -- cgit v1.3