Skip to content
Myr

test: deleting props added in the producer

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

authored by aleclarson · committed by aleclarson · parent c0ce252 · Browse files · 1 file+19 added−0 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+19 added−0 removed

  • tests:+19 added−0 removed

1 file+19 added−0 removed

modified:__tests__/base.js+19 added
120 unmodified lines
121 expect(nextState.anObject).not.toBe(baseState.anObject)122 expect(nextState.anObject.nested).toBe(undefined)123 })124125 // Found by: https://github.com/mweststrate/immer/pull/267126 it("can delete props added in the producer", () => {127 const nextState = produce(128 baseState,129 s => {130 s.anObject.test = true131 delete s.anObject.test132 },133 listener134 )135 if (useProxies) {136 expect(nextState).not.toBe(baseState)137 expect(nextState).toEqual(baseState)138 } else {139 // The copy is avoided in ES5.140 expect(nextState).toBe(baseState)141 }142 })143144 it("ignores single non-modification", () => {145 const nextState = produce(146 baseState,147 s => {
1390 unmodified lines