Skip to content
Myr

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 97ce2d4 · Browse files · 1 file+11 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

1 file+11 added−0 removed

  • tests:+11 added−0 removed

1 file+11 added−0 removed

modified:__tests__/base.js+11 added
146 unmodified lines
147 1148 ])149 })150151 it("can delete array items", () => {152 const nextState = immer(baseState, s => {153 s.anArray.length = 3154 })155 expect(nextState).not.toBe(baseState)156 expect(nextState.anObject).toBe(baseState.anObject)157 expect(nextState.anArray).not.toBe(baseState.anArray)158 expect(nextState.anArray).toEqual([3, 2, {c: 3}])159 })160161 it("should support sorting arrays", () => {162 const nextState = immer(baseState, s => {163 s.anArray[2].c = 4164 s.anArray.sort()
82 unmodified lines
247 s.aProp = "hello"248 delete s.anObject249 obj.coffee = true250 s.messy = obj251 debugger252 })253 expect(nextState).not.toBe(baseState)254 expect(nextState.anArray).toBe(baseState.anArray)255 expect(enumerableOnly(nextState)).toEqual({
108 unmodified lines