Skip to content
Myr

Freeze new data

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 5ac3ef7 · Browse files · 1 file+12 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+12 added−0 removed

  • tests:+12 added−0 removed

1 file+12 added−0 removed

modified:__tests__/base.js+12 added
598 unmodified lines
599 expect(next).not.toBe(base)600 expect(next.user).toEqual(user)601 })602603 if (freeze)604 it("should freeze new data well", () => {605 const base = {}606 const next = produce(base, draft => {607 draft.x = {y: [{z: true}]}608 })609 expect(Object.isFrozen(next)).toBe(true)610 expect(Object.isFrozen(next.x)).toBe(true)611 expect(Object.isFrozen(next.x.y)).toBe(true)612 expect(Object.isFrozen(next.x.y[0].z)).toBe(true)613 })614615 afterEach(() => {616 expect(baseState).toBe(origBaseState)617 expect(baseState).toEqual(createBaseState())618 })
21 unmodified lines