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 committed Mar 7, 2018
1 parent 7392dfc commit aeebf0d
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 aeebf0d

Please sign in to comment.