plugins.js
This file
Path
__tests__/plugins.js
49 lines · 936 bytes · JavaScript
Last changed by
Tests for pluginsMichel Weststratebefore adoptiondb16520
History of this fileTake it
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950import produce, { setUseProxies, produceWithPatches, applyPatches} from "../src/immer"
describe("ES5 plugins should throw if no proxies are available", () => { beforeEach(() => { setUseProxies(false) })
afterEach(() => { setUseProxies(true) })
test("error when using ES5", () => { expect(() => { produce({}, function() {}) }).toThrowErrorMatchingSnapshot() })})
test("error when using Maps", () => { expect(() => { produce(new Map(), function() {}) }).toThrowErrorMatchingSnapshot()})
test("error when using patches - 1", () => { expect(() => { produce( {}, function() {}, function() {} ) }).toThrowErrorMatchingSnapshot()})
test("error when using patches - 2", () => { expect(() => { produceWithPatches({}, function() {}) }).toThrowErrorMatchingSnapshot()})
test("error when using patches - 3", () => { expect(() => { applyPatches({}, []) }).toThrowErrorMatchingSnapshot()})