Skip to content
Myr

improve tests for freezing of return values

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

authored by aleclarson · committed by aleclarson · parent 172d76a · Browse files · 2 files+101 added−44 removed
This commit

State

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

Diff stats

2 files+101 added−44 removed

  • tests:+101 added−44 removed

2 files+101 added−44 removed

modified:__tests__/base.js-16 removed
870 unmodified lines
871 expect(next).not.toBe(base)872 expect(next.user).toEqual(user)873 })874875 if (freeze)876 it("should freeze new data well", () => {877 const base = {}878 const next = produce(879 base,880 draft => {881 draft.x = {y: [{z: true}]}882 },883 listener884 )885 expect(Object.isFrozen(next)).toBe(true)886 expect(Object.isFrozen(next.x)).toBe(true)887 expect(Object.isFrozen(next.x.y)).toBe(true)888 expect(Object.isFrozen(next.x.y[0].z)).toBe(true)889 })890875 it("should structurally share identical objects in the tree", () => {876 const base = {bear: {legs: 4}, eagle: {legs: 3}}877 const next = produce(878 base,
476 unmodified lines
modified:__tests__/frozen.js+101 added-28 removed