Skip to content
Myr

test: remove defuseProxies helper

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Alec Larson · committed by Alec Larson · parent e56ad54 · Browse files · 1 file+3 added−12 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−12 removed

  • tests:+3 added−12 removed

1 file+3 added−12 removed

modified:__tests__/hooks.js+3 added-12 removed
11 unmodified lines
12 beforeEach(() => {13 ;({produce, onAssign, onDelete, onCopy} = new Immer({14 autoFreeze: true,15 useProxies,16 onAssign: defuseProxies(jest.fn().mockName("onAssign")),17 onDelete: defuseProxies(jest.fn().mockName("onDelete")),18 onCopy: defuseProxies(jest.fn().mockName("onCopy"))16 onAssign: jest.fn().mockName("onAssign"),17 onDelete: jest.fn().mockName("onDelete"),18 onCopy: jest.fn().mockName("onCopy")19 }))20 })2122 describe("onAssign()", () => {
334 unmodified lines
357 })358 ).toMatchSnapshot()359}360361// For defusing draft proxies.362function defuseProxies(fn) {363 return Object.assign((...args) => {364 expect(args[0].finalized).toBeTruthy()365 args[0].draft = args[0].drafts = null366 fn(...args)367 }, fn)368}369361expect.extend({362 toShallowEqual(received, expected) {363 const match = matchers.toBe(received, expected)364 return match.pass || !received || typeof received !== "object"
7 unmodified lines