Skip to content
Myr

test: tried to reproduce #469

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 dbedded · Browse files · 1 file+19 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+19 added−0 removed

  • tests:+19 added−0 removed

1 file+19 added−0 removed

modified:__tests__/base.js+19 added
1234 unmodified lines
1235 expect(base[0].a).toEqual(1)1236 expect(result[0].a).toEqual(2)1237 })12381239 autoFreeze &&1240 test("issue #469, state not frozen", () => {1241 const project = produce(1242 {1243 id: 1,1244 tracks: [{id: 1}]1245 },1246 () => {}1247 )12481249 expect(() => {1250 project.id = 2 // Does not throw error1251 }).toThrowError("Cannot assign to read only property 'id'")12521253 expect(() => {1254 Object.assign(project, {id: 2}) // Uncaught TypeError: Cannot assign to read only property 'id' of object '#<Object>'1255 }).toThrowError("Cannot assign to read only property 'id'")1256 })12571258 describe("recipe functions", () => {1259 it("can return a new object", () => {1260 const base = {x: 3}1261 const res = produce(base, d => {
510 unmodified lines