From 841e58605049c18b22cdc15d83d1b015fbb7c3aa Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Mon, 4 Jun 2018 14:15:53 +0200 Subject: [PATCH] Tests to verify #1567 --- test/base/makereactive.js | 48 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/test/base/makereactive.js b/test/base/makereactive.js index cefeed50d..ed16990fb 100644 --- a/test/base/makereactive.js +++ b/test/base/makereactive.js @@ -687,3 +687,51 @@ test("structural collections", () => { o.x = mobx.observable([1, 2, 3]) }).toThrow("observable.struct should not be used with observable values") }) + +test.skip("jest is behaving correctly", () => { + // this failing test is fixed here: + // https://github.com/facebook/jest/pull/6391 + const symbol = Symbol("test") + const a = [] + const b = [] + const c = [] + a[symbol] = 1 + b[symbol] = 1 + c[symbol] = 2 + expect(a).toEqual(b) + expect(a).not.toEqual(c) +}) + +test("jest object equals issue - reference", () => { + class Store { + constructor() { + mobx.extendObservable(this, { x: 3 }) + } + } + + const store = new Store() + expect(store).toEqual(new Store()) +}) + +test("jest object equals issue", () => { + class Store { + @mobx.observable x = 2 + + constructor() { + this.x = 3 + } + } + + const store = new Store() + expect(store).toEqual(new Store()) +}) + +test("jest array equals issue", () => { + debugger + class Store { + @mobx.observable things = [] + } + + const store = new Store() + expect(store.things).toEqual([]) +})