Skip to content
Myr

reproduce a bug on using lodash.find

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

authored by iruca3 · committed by iruca3 · parent 69aedd8 · Browse files · 3 files+18 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

3 files+18 added−0 removed

  • tests:+13 added−0 removed
  • other:+5 added−0 removed

3 files+18 added−0 removed

modified:__tests__/base.js+13 added
1"use strict"2import produce, {setAutoFreeze, setUseProxies} from "../src/immer"3import deepFreeze from "deep-freeze"4import cloneDeep from "lodash.clonedeep"5import find from "lodash.find"67jest.setTimeout(1000)89runBaseTest("proxy (no freeze)", true, false)
107 unmodified lines
117 expect(nextState).not.toBe(baseState)118 expect(nextState).toEqual(baseState)119 })120121 it("processes with lodash.find", () => {122 const base = [{id: 1, a: 1}, {id: 2, a: 1}]123 const result = produce(base, draft => {124 const obj1 = find(draft, {id: 1})125 const obj2 = find(draft, {id: 2})126 obj1.a = 2127 obj2.a = 2128 })129 expect(result[0].a).toEqual(2)130 expect(result[1].a).toEqual(2)131 })132133 it("should support reading arrays", () => {134 const nextState = produce(baseState, s => {135 s.anArray.slice()136 })
646 unmodified lines
modified:package.json+1 added
modified:yarn.lock+4 added
2276 unmodified lines
2277lodash.clonedeep@^4.5.0:2278 version "4.5.0"2279 resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"22802281lodash.find@^4.6.0:2282 version "4.6.0"2283 resolved "https://registry.yarnpkg.com/lodash.find/-/lodash.find-4.6.0.tgz#cb0704d47ab71789ffa0de8b97dd926fb88b13b1"22842285lodash.sortby@^4.7.0:2286 version "4.7.0"2287 resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"2288
1254 unmodified lines