Skip to content
Myr

Update Tests

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

authored by dalcib · committed by dalcib · parent fda6328 · Browse files · 1 file+10 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+10 added−0 removed

  • tests:+10 added−0 removed

1 file+10 added−0 removed

modified:__tests__/base.js+10 added
2106 unmodified lines
21072108 it("should use a method to assing a field using a getter that return a non primitive object", () => {2109 const newState = produce(state, draft => {2110 draft.syncFoo()2111 expect(draft.bar).toEqual({baz: 1})2112 })2113 expect(newState.foo).toEqual(1)2114 expect(newState.bar).toEqual({baz: 1})2115 expect(state.bar).toEqual({baz: 1})2116 })2117 })21182119 describe("class with setters", () => {2120 class State {2121 [immerable] = true2122 _bar = 02123 get bar() {2124 return this._bar2125 }2126 set bar(x) {2127 this._bar = x2128 }2129 }
1 unmodified line
21312132 it("should define a field with a setter", () => {2133 const newState3 = produce(state, d => {2134 d.bar = 12135 expect(d._bar).toEqual(1)2136 })2137 expect(newState3._bar).toEqual(1)2138 expect(newState3.bar).toEqual(1)2139 expect(state._bar).toEqual(0)2140 expect(state.bar).toEqual(0)2141 })2142 })2143}2144
68 unmodified lines