From: 夜宴 <1996yeyan@gmail.com> Date: Fri, 25 Oct 2019 14:17:31 +0000 (-0500) Subject: test(effect): add test for json methods (#371) X-Git-Tag: v3.0.0-alpha.0~311 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=57276f9dcb25d4702eda982ac14611e17a2904cb;p=thirdparty%2Fvuejs%2Fcore.git test(effect): add test for json methods (#371) --- 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