test(reactivity/effect): add test for lazy option (#179)
This commit is contained in:
parent
211f5b7a45
commit
b7b89505eb
@ -505,6 +505,18 @@ describe('reactivity/effect', () => {
|
||||
expect(dummy).toBe(1)
|
||||
})
|
||||
|
||||
it('lazy', () => {
|
||||
const obj = reactive({ foo: 1 })
|
||||
let dummy
|
||||
const runner = effect(() => (dummy = obj.foo), { lazy: true })
|
||||
expect(dummy).toBe(undefined)
|
||||
|
||||
expect(runner()).toBe(1)
|
||||
expect(dummy).toBe(1)
|
||||
obj.foo = 2
|
||||
expect(dummy).toBe(2)
|
||||
})
|
||||
|
||||
it('scheduler', () => {
|
||||
let runner: any, dummy
|
||||
const scheduler = jest.fn(_runner => {
|
||||
|
Loading…
Reference in New Issue
Block a user