Skip to content

Commit

Permalink
test: add test for observer lazy getter invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 authored and aJean committed Aug 19, 2020
1 parent 3e4e83f commit c41f65c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/unit/modules/observer/observer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,4 +355,18 @@ describe('Observer', () => {
expect(obj.__ob__ instanceof Observer).toBe(true)
})
})

it('should lazy invoke existing getters', () => {
const obj = {}
let called = false
Object.defineProperty(obj, 'getterProp', {
enumerable: true,
get: () => {
called = true
return 'some value'
}
})
observe(obj)
expect(called).toBe(false)
})
})

0 comments on commit c41f65c

Please sign in to comment.