test(effect): add test for json methods (#371)

This commit is contained in:
夜宴 2019-10-25 09:17:31 -05:00 committed by Evan You
parent 8c1638da33
commit 57276f9dcb

View File

@ -515,6 +515,16 @@ describe('reactivity/effect', () => {
expect(childSpy).toHaveBeenCalledTimes(5)
})
it('should observe json methods', () => {
let dummy = <Record<string, number>>{}
const obj = reactive<Record<string, number>>({})
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