Skip to content
Myr

Merge pull request #158 from stefanwille/base-test-uses-if-instead-of-it

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

authored by benbraou · committed by GitHub · parents 537aa92, 424afc6 · Browse files · 1 file+21 added−23 removed
This commit

State

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

Trailers

  • Fix: Base test uses "if(...)" instead of it(...)"

Diff stats

1 file+21 added−23 removed

  • tests:+21 added−23 removed

1 file+21 added−23 removed

modified:__tests__/base.js+21 added-23 removed
44 unmodified lines
45 // structural sharing?46 expect(nextState.nested).toBe(baseState.nested)47 })4849 if (50 ("should preserve type",51 () => {52 const nextState = produce(baseState, s => {53 expect(Array.isArray(s)).toBe(true)54 expect(s.protoType).toBe(Object)55 s.anArray.push(3)56 s.aProp = "hello world"57 expect(Array.isArray(s)).toBe(true)58 expect(s.protoType).toBe(Object)59 })60 expect(Array.isArray(nextState)).toBe(true)61 expect(nextState.protoType).toBe(Object)49 it("should preserve type", () => {50 const nextState = produce(baseState, s => {51 expect(Object.getPrototypeOf(s)).toBe(Object.prototype)52 expect(Array.isArray(s.anArray)).toBe(true)53 s.anArray.push(3)54 s.aProp = "hello world"55 expect(Object.getPrototypeOf(s)).toBe(Object.prototype)56 expect(Array.isArray(s.anArray)).toBe(true)57 })63 )64 it("deep change bubbles up", () => {65 const nextState = produce(baseState, s => {66 s.anObject.nested.yummie = false67 })68 expect(nextState).not.toBe(baseState)69 expect(nextState.anObject).not.toBe(baseState.anObject)70 expect(baseState.anObject.nested.yummie).toBe(true)71 expect(nextState.anObject.nested.yummie).toBe(false)72 expect(nextState.anArray).toBe(baseState.anArray)58 expect(Object.getPrototypeOf(nextState)).toBe(Object.prototype)59 expect(Array.isArray(nextState.anArray)).toBe(true)60 })6162 it("deep change bubbles up", () => {63 const nextState = produce(baseState, s => {64 s.anObject.nested.yummie = false65 })66 expect(nextState).not.toBe(baseState)67 expect(nextState.anObject).not.toBe(baseState.anObject)68 expect(baseState.anObject.nested.yummie).toBe(true)69 expect(nextState.anObject.nested.yummie).toBe(false)70 expect(nextState.anArray).toBe(baseState.anArray)71 })7273 it("can add props", () => {74 const nextState = produce(baseState, s => {75 s.anObject.cookie = {tasty: true}
875 unmodified lines