Skip to content
Myr

added some additional tests to verify solution correctness of #86

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 224bf50 · Browse files · 2 files+21 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

2 files+21 added−0 removed

  • tests:+20 added−0 removed
  • other:+1 added−0 removed

2 files+21 added−0 removed

modified:__tests__/base.js+20 added
1"use strict"2import produce, {setAutoFreeze, setUseProxies} from "../src/immer"3import deepFreeze from "deep-freeze"4import cloneDeep from "lodash.clonedeep"5import * as lodash from "lodash"67jest.setTimeout(1000)89runBaseTest("proxy (no freeze)", true, false)
793 unmodified lines
803 }804 })805 })806807 it("processes with lodash.set", () => {808 const base = [{id: 1, a: 1}]809 const result = produce(base, draft => {810 lodash.set(draft, "[0].a", 2)811 })812 expect(base[0].a).toEqual(1)813 expect(result[0].a).toEqual(2)814 })815816 it("processes with lodash.find", () => {817 const base = [{id: 1, a: 1}]818 const result = produce(base, draft => {819 const obj1 = lodash.find(draft, {id: 1})820 lodash.set(obj1, "a", 2)821 })822 expect(base[0].a).toEqual(1)823 expect(result[0].a).toEqual(2)824 })825826 afterEach(() => {827 expect(baseState).toBe(origBaseState)828 expect(baseState).toEqual(createBaseState())829 })
21 unmodified lines
modified:package.json+1 added