From 57276f9dcb25d4702eda982ac14611e17a2904cb Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=A4=9C=E5=AE=B4?= <1996yeyan@gmail.com> Date: Fri, 25 Oct 2019 09:17:31 -0500 Subject: [PATCH] test(effect): add test for json methods (#371) --- packages/reactivity/__tests__/effect.spec.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/reactivity/__tests__/effect.spec.ts b/packages/reactivity/__tests__/effect.spec.ts index 9ddd8e059f..ec66c2b2c2 100644 --- a/packages/reactivity/__tests__/effect.spec.ts +++ b/packages/reactivity/__tests__/effect.spec.ts @@ -515,6 +515,16 @@ describe('reactivity/effect', () => { expect(childSpy).toHaveBeenCalledTimes(5) }) + it('should observe json methods', () => { + let dummy = >{} + const obj = reactive>({}) + effect(() => { + dummy = JSON.parse(JSON.stringify(obj)) + }) + obj.a = 1 + expect(dummy.a).toBe(1) + }) + it('should observe class method invocations', () => { class Model { count: number -- 2.47.3