empty.ts
This file
Path
__tests__/empty.ts
29 lines · 675 bytes · TypeScript
Last changed by
map unification WIPMichel Weststratebefore adoption9bcefb6
History of this fileTake it
123456789101112131415161718192021222324252627282930import {produce, produceWithPatches, setUseProxies} from "../src"
test("empty stub test", () => { expect(true).toBe(true)})
describe("map set", () => { test("can assign set value", () => { setUseProxies(false)
const baseState = new Map([["x", 1]]) const nextState = produce(baseState, s => { s.set("x", 2) }) expect(nextState).not.toBe(baseState) expect(nextState.get("x")).toEqual(2) })
test("can assign by key", () => { setUseProxies(false)
const baseState = new Map([["x", {a: 1}]]) const nextState = produce(baseState, s => { s.get("x")!.a++ }) expect(nextState).not.toBe(baseState) expect(nextState.get("x")!.a).toEqual(2) })})