Skip to content
Myr

Reproduced #66

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 334652e · Browse files · 1 file+25 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+25 added−1 removed

  • tests:+25 added−1 removed

1 file+25 added−1 removed

modified:__tests__/base.js+25 added-1 removed
1"use strict"2import produce, {setAutoFreeze, setUseProxies} from "../src"3import deepFreeze from "deep-freeze"4import cloneDeep from "lodash.clonedeep"56jest.setTimeout(1000)78runBaseTest("proxy (no freeze)", true, false)
410 unmodified lines
419420 if (useProxies === true) {421 it("should not be possible to set property descriptors", () => {422 expect(() => {422 debugger423 produce({}, draft => {424 Object.defineProperty(draft, "xx", {425 enumerable: true,426 writeable: true,
149 unmodified lines
576 expect(next.paw.honey).toBe(false)577 expect(next).not.toBe(bear)578 })579580 it("should not try to change immutable data, see #66", () => {581 const user = require("./test-data")582583 const base = {}584 const next = produce(base, draft => {585 draft.user = user586 })587 expect(next.user).toBe(user)588 expect(next).not.toBe(base)589 expect(next.user).toEqual(user)590 })591592 it("should not try to change immutable data, see #66 - 2", () => {593 const user = deepFreeze(cloneDeep(require("./test-data")))594595 const base = {}596 const next = produce(base, draft => {597 draft.user = user598 })599 expect(next.user).toBe(user)600 expect(next).not.toBe(base)601 expect(next.user).toEqual(user)602 })603604 afterEach(() => {605 expect(baseState).toBe(origBaseState)606 expect(baseState).toEqual(createBaseState())607 })
21 unmodified lines