diff options
| author | Wes Bos <wesbos@gmail.com> | 2018-04-19 11:16:53 -0400 |
|---|---|---|
| committer | Wes Bos <wesbos@gmail.com> | 2018-04-19 11:16:53 -0400 |
| commit | 990d5ec5af9cea56812e952c3155a346876621cb (patch) | |
| tree | 90a0e31f95592c09d9957376227443d7467eb679 /frontend/jest.setup.js | |
| parent | 88ef4bd2df970cb6ea89123ffdd7fcb21dbc0f15 (diff) | |
custom assertion
Diffstat (limited to 'frontend/jest.setup.js')
| -rw-r--r-- | frontend/jest.setup.js | 13 |
1 files changed, 13 insertions, 0 deletions
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 }; + }, +}); |
