Skip to content
Myr

Added regression test to verify #588

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

authored by Michel Weststrate · committed by Michel Weststrate · parent 529e289 · Browse files · 1 file+27 added−1 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+27 added−1 removed

  • tests:+27 added−1 removed

1 file+27 added−1 removed

modified:__tests__/patch.js+27 added-1 removed
2 unmodified lines
3 setUseProxies,4 applyPatches,5 produceWithPatches,6 enableAllPlugins,7 isDraft7 isDraft,8 immerable9} from "../src/immer"1011enableAllPlugins()12
1035 unmodified lines
1048 const reversedSubState = applyPatches(newState.sub, inverseChanges)10491050 expect(reversedSubState).toMatchObject(state.sub)1051})10521053describe("#588", () => {1054 const reference = {value: {num: 53}}10551056 class Base {1057 [immerable] = true1058 get nested() {1059 return reference.value1060 }1061 set nested(value) {}1062 }10631064 let base = new Base()10651066 runPatchTest(1067 base,1068 vdraft => {1069 reference.value = vdraft1070 produce(base, bdraft => {1071 bdraft.nested.num = 421072 })1073 },1074 [{op: "add", path: ["num"], value: 42}]1075 )1076})