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 c7a47e2 · Browse files · 1 file+18 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+18 added−1 removed

  • tests:+18 added−1 removed

1 file+18 added−1 removed

modified:__tests__/base.js+18 added-1 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", () => {478 const nextState = produce(baseState, s => {479 // let res = s.aMap.set("new_key", 1)480481 s.aMap.set("new_key", undefined)482 })483 expect(nextState.aMap.has("new_key")).toBe(true)484 })485486 it("OK ==> new key with value=undefine", () => {487 const nextState = produce(baseState, s => {488 s.aMap.set("new_key", 1)489 s.aMap.set("new_key", undefined)490 })491 expect(nextState.aMap.has("new_key")).toBe(true)492 })493 494 it("can assign by a non-primitive key", () => {495 const key = {prop: "val"}496 const value = {id: 1, a: 1}497 const base = new Map([[key, value]])
1972 unmodified lines