Skip to content
Myr

Update base.js

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

authored by visciang · committed by GitHub · parent 237196a · Browse files · 1 file+8 added−10 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+8 added−10 removed

  • tests:+8 added−10 removed

1 file+8 added−10 removed

modified:__tests__/base.js+8 added-10 removed
463 unmodified lines
464 })465466 it("can assign by key", () => {467 const nextState = produce(baseState, s => {468 // Map.prototype.set should return the Map itself468 // Map.prototype.set should return the Map itself469 const res = s.aMap.set("force", true)470 if (!global.USES_BUILD) expect(res).toBe(s.aMap[DRAFT_STATE].draft_)471 })472 expect(nextState).not.toBe(baseState)473 expect(nextState.aMap).not.toBe(baseState.aMap)474 expect(nextState.aMap.get("force")).toEqual(true)475 })476477 it("KO ==> new key with value=undefine", () => {477 it("KO ==> new key with value=undefine", () => {478 const nextState = produce(baseState, s => {479 // let res = s.aMap.set("new_key", 1)480481 s.aMap.set("new_key", undefined)479 s.aMap.set("new_key", undefined)480 })481 expect(nextState.aMap.has("new_key")).toBe(true)484 })482 })483486 it("OK ==> new key with value=undefine", () => {484 it("OK ==> new key with value=undefine", () => {485 const nextState = produce(baseState, s => {488 s.aMap.set("new_key", 1)489 s.aMap.set("new_key", undefined)486 s.aMap.set("new_key", 1)487 s.aMap.set("new_key", undefined)488 })489 expect(nextState.aMap.has("new_key")).toBe(true)492 })490 })491 492 it("can assign by a non-primitive key", () => {493 const key = {prop: "val"}494 const value = {id: 1, a: 1}
1973 unmodified lines