Skip to content
Myr

Fixed & added tests

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 fd9ed2d · Browse files · 4 files+45 added−3 removed
This commit

State

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

Diff stats

4 files+45 added−3 removed

  • tests:+43 added−2 removed
  • other:+2 added−1 removed

4 files+45 added−3 removed

modified:__tests__/base.js+20 added
953 unmodified lines
954 // so we don't atm955 expect(nextState).not.toBe(baseState)956 })957958 it("should not detect noop assignments - 3", () => {959 const baseState = {x: 3}960 const nextState = produce(baseState, d => {961 d.x = 3962 })963 expect(nextState).toBe(baseState)964 })965966 it("should not detect noop assignments - 4", () => {967 const baseState = {x: 3}968 const nextState = produce(baseState, d => {969 d.x = 4970 d.x = 3971 })972 // Ideally, this should actually be the same instances973 // but this would be pretty expensive to detect,974 // so we don't atm975 expect(nextState).not.toBe(baseState)976 })977978 it("immer should have no dependencies", () => {979 expect(require("../package.json").dependencies).toEqual(undefined)980 })981
25 unmodified lines
modified:__tests__/curry.js+2 added-2 removed
modified:__tests__/patch.js+21 added
226 unmodified lines
227 [{op: "replace", path: ["x"], value: {y: 3}}]228 )229})230231describe("same value replacement - 3", () => {232 runPatchTest(233 {x: 3},234 d => {235 d.x = 3236 },237 []238 )239})240241describe("same value replacement - 4", () => {242 runPatchTest(243 {x: 3},244 d => {245 d.x = 4246 d.x = 3247 },248 // immer does not detect this is not an actual change249 [{op: "replace", path: ["x"], value: 3}]250 )251})252describe("simple delete", () => {253 runPatchTest(254 {x: 2},255 d => {
10 unmodified lines
modified:src/immer.js+2 added-1 removed