2020-02-11 02:09:15 +08:00
|
|
|
import {
|
|
|
|
queueJob,
|
|
|
|
nextTick,
|
|
|
|
queuePostFlushCb,
|
2020-08-05 22:55:23 +08:00
|
|
|
invalidateJob,
|
2022-08-15 19:00:55 +08:00
|
|
|
flushPostFlushCbs,
|
|
|
|
flushPreFlushCbs
|
2020-02-11 02:09:15 +08:00
|
|
|
} from '../src/scheduler'
|
2019-11-17 05:32:06 +08:00
|
|
|
|
|
|
|
describe('scheduler', () => {
|
|
|
|
it('nextTick', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const dummyThen = Promise.resolve().then()
|
|
|
|
const job1 = () => {
|
|
|
|
calls.push('job1')
|
|
|
|
}
|
|
|
|
const job2 = () => {
|
|
|
|
calls.push('job2')
|
|
|
|
}
|
|
|
|
nextTick(job1)
|
|
|
|
job2()
|
|
|
|
|
|
|
|
expect(calls.length).toBe(1)
|
|
|
|
await dummyThen
|
|
|
|
// job1 will be pushed in nextTick
|
|
|
|
expect(calls.length).toBe(2)
|
|
|
|
expect(calls).toMatchObject(['job2', 'job1'])
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('queueJob', () => {
|
|
|
|
it('basic usage', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const job1 = () => {
|
|
|
|
calls.push('job1')
|
|
|
|
}
|
|
|
|
const job2 = () => {
|
|
|
|
calls.push('job2')
|
|
|
|
}
|
|
|
|
queueJob(job1)
|
|
|
|
queueJob(job2)
|
|
|
|
expect(calls).toEqual([])
|
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['job1', 'job2'])
|
|
|
|
})
|
|
|
|
|
2021-02-25 22:37:25 +08:00
|
|
|
it("should insert jobs in ascending order of job's id when flushing", async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const job1 = () => {
|
|
|
|
calls.push('job1')
|
|
|
|
|
|
|
|
queueJob(job2)
|
|
|
|
queueJob(job3)
|
|
|
|
}
|
|
|
|
|
|
|
|
const job2 = () => {
|
|
|
|
calls.push('job2')
|
2021-07-20 01:37:35 +08:00
|
|
|
queueJob(job4)
|
|
|
|
queueJob(job5)
|
2021-02-25 22:37:25 +08:00
|
|
|
}
|
|
|
|
job2.id = 10
|
|
|
|
|
|
|
|
const job3 = () => {
|
|
|
|
calls.push('job3')
|
|
|
|
}
|
|
|
|
job3.id = 1
|
|
|
|
|
|
|
|
const job4 = () => {
|
|
|
|
calls.push('job4')
|
|
|
|
}
|
|
|
|
|
2021-07-20 01:37:35 +08:00
|
|
|
const job5 = () => {
|
|
|
|
calls.push('job5')
|
|
|
|
}
|
|
|
|
|
2021-02-25 22:37:25 +08:00
|
|
|
queueJob(job1)
|
|
|
|
|
|
|
|
expect(calls).toEqual([])
|
|
|
|
await nextTick()
|
2021-07-20 01:37:35 +08:00
|
|
|
expect(calls).toEqual(['job1', 'job3', 'job2', 'job4', 'job5'])
|
2021-02-25 22:37:25 +08:00
|
|
|
})
|
|
|
|
|
2019-11-17 05:32:06 +08:00
|
|
|
it('should dedupe queued jobs', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const job1 = () => {
|
|
|
|
calls.push('job1')
|
|
|
|
}
|
|
|
|
const job2 = () => {
|
|
|
|
calls.push('job2')
|
|
|
|
}
|
|
|
|
queueJob(job1)
|
|
|
|
queueJob(job2)
|
|
|
|
queueJob(job1)
|
|
|
|
queueJob(job2)
|
|
|
|
expect(calls).toEqual([])
|
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['job1', 'job2'])
|
|
|
|
})
|
|
|
|
|
|
|
|
it('queueJob while flushing', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const job1 = () => {
|
|
|
|
calls.push('job1')
|
2020-05-01 21:42:58 +08:00
|
|
|
// job2 will be executed after job1 at the same tick
|
2019-11-17 05:32:06 +08:00
|
|
|
queueJob(job2)
|
|
|
|
}
|
|
|
|
const job2 = () => {
|
|
|
|
calls.push('job2')
|
|
|
|
}
|
|
|
|
queueJob(job1)
|
|
|
|
|
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['job1', 'job2'])
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2022-08-15 19:00:55 +08:00
|
|
|
describe('pre flush jobs', () => {
|
2020-08-05 22:55:23 +08:00
|
|
|
it('queueJob inside preFlushCb', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const job1 = () => {
|
|
|
|
calls.push('job1')
|
|
|
|
}
|
|
|
|
const cb1 = () => {
|
|
|
|
// queueJob in postFlushCb
|
|
|
|
calls.push('cb1')
|
|
|
|
queueJob(job1)
|
|
|
|
}
|
2022-08-15 19:00:55 +08:00
|
|
|
cb1.pre = true
|
2020-08-05 22:55:23 +08:00
|
|
|
|
2022-08-15 19:00:55 +08:00
|
|
|
queueJob(cb1)
|
2020-08-05 22:55:23 +08:00
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['cb1', 'job1'])
|
|
|
|
})
|
|
|
|
|
|
|
|
it('queueJob & preFlushCb inside preFlushCb', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const job1 = () => {
|
|
|
|
calls.push('job1')
|
|
|
|
}
|
2022-08-15 19:00:55 +08:00
|
|
|
job1.id = 1
|
|
|
|
|
2020-08-05 22:55:23 +08:00
|
|
|
const cb1 = () => {
|
|
|
|
calls.push('cb1')
|
|
|
|
queueJob(job1)
|
|
|
|
// cb2 should execute before the job
|
2022-08-15 19:00:55 +08:00
|
|
|
queueJob(cb2)
|
2020-08-05 22:55:23 +08:00
|
|
|
}
|
2022-08-15 19:00:55 +08:00
|
|
|
cb1.pre = true
|
|
|
|
|
2020-08-05 22:55:23 +08:00
|
|
|
const cb2 = () => {
|
|
|
|
calls.push('cb2')
|
|
|
|
}
|
2022-08-15 19:00:55 +08:00
|
|
|
cb2.pre = true
|
|
|
|
cb2.id = 1
|
2020-08-05 22:55:23 +08:00
|
|
|
|
2022-08-15 19:00:55 +08:00
|
|
|
queueJob(cb1)
|
2020-08-05 22:55:23 +08:00
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['cb1', 'cb2', 'job1'])
|
|
|
|
})
|
|
|
|
|
|
|
|
it('preFlushCb inside queueJob', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const job1 = () => {
|
|
|
|
// the only case where a pre-flush cb can be queued inside a job is
|
|
|
|
// when updating the props of a child component. This is handled
|
|
|
|
// directly inside `updateComponentPreRender` to avoid non atomic
|
|
|
|
// cb triggers (#1763)
|
2022-08-15 19:00:55 +08:00
|
|
|
queueJob(cb1)
|
|
|
|
queueJob(cb2)
|
|
|
|
flushPreFlushCbs()
|
2020-08-05 22:55:23 +08:00
|
|
|
calls.push('job1')
|
|
|
|
}
|
|
|
|
const cb1 = () => {
|
|
|
|
calls.push('cb1')
|
|
|
|
// a cb triggers its parent job, which should be skipped
|
|
|
|
queueJob(job1)
|
|
|
|
}
|
2022-08-15 19:00:55 +08:00
|
|
|
cb1.pre = true
|
2020-08-05 22:55:23 +08:00
|
|
|
const cb2 = () => {
|
|
|
|
calls.push('cb2')
|
|
|
|
}
|
2022-08-15 19:00:55 +08:00
|
|
|
cb2.pre = true
|
2020-08-05 22:55:23 +08:00
|
|
|
|
|
|
|
queueJob(job1)
|
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['cb1', 'cb2', 'job1'])
|
|
|
|
})
|
2021-05-27 02:21:49 +08:00
|
|
|
|
|
|
|
// #3806
|
|
|
|
it('queue preFlushCb inside postFlushCb', async () => {
|
2022-08-15 19:00:55 +08:00
|
|
|
const spy = jest.fn()
|
|
|
|
const cb = () => spy()
|
|
|
|
cb.pre = true
|
2021-05-27 02:21:49 +08:00
|
|
|
queuePostFlushCb(() => {
|
2022-08-15 19:00:55 +08:00
|
|
|
queueJob(cb)
|
2021-05-27 02:21:49 +08:00
|
|
|
})
|
|
|
|
await nextTick()
|
2022-08-15 19:00:55 +08:00
|
|
|
expect(spy).toHaveBeenCalled()
|
2021-05-27 02:21:49 +08:00
|
|
|
})
|
2020-08-05 22:55:23 +08:00
|
|
|
})
|
|
|
|
|
2019-11-17 05:32:06 +08:00
|
|
|
describe('queuePostFlushCb', () => {
|
|
|
|
it('basic usage', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const cb1 = () => {
|
|
|
|
calls.push('cb1')
|
|
|
|
}
|
|
|
|
const cb2 = () => {
|
|
|
|
calls.push('cb2')
|
|
|
|
}
|
|
|
|
const cb3 = () => {
|
|
|
|
calls.push('cb3')
|
|
|
|
}
|
|
|
|
|
|
|
|
queuePostFlushCb([cb1, cb2])
|
|
|
|
queuePostFlushCb(cb3)
|
|
|
|
|
|
|
|
expect(calls).toEqual([])
|
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['cb1', 'cb2', 'cb3'])
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should dedupe queued postFlushCb', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const cb1 = () => {
|
|
|
|
calls.push('cb1')
|
|
|
|
}
|
|
|
|
const cb2 = () => {
|
|
|
|
calls.push('cb2')
|
|
|
|
}
|
|
|
|
const cb3 = () => {
|
|
|
|
calls.push('cb3')
|
|
|
|
}
|
|
|
|
|
|
|
|
queuePostFlushCb([cb1, cb2])
|
|
|
|
queuePostFlushCb(cb3)
|
|
|
|
|
|
|
|
queuePostFlushCb([cb1, cb3])
|
|
|
|
queuePostFlushCb(cb2)
|
|
|
|
|
|
|
|
expect(calls).toEqual([])
|
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['cb1', 'cb2', 'cb3'])
|
|
|
|
})
|
|
|
|
|
|
|
|
it('queuePostFlushCb while flushing', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const cb1 = () => {
|
|
|
|
calls.push('cb1')
|
2020-05-01 21:42:58 +08:00
|
|
|
// cb2 will be executed after cb1 at the same tick
|
2019-11-17 05:32:06 +08:00
|
|
|
queuePostFlushCb(cb2)
|
|
|
|
}
|
|
|
|
const cb2 = () => {
|
|
|
|
calls.push('cb2')
|
|
|
|
}
|
|
|
|
queuePostFlushCb(cb1)
|
|
|
|
|
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['cb1', 'cb2'])
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('queueJob w/ queuePostFlushCb', () => {
|
|
|
|
it('queueJob inside postFlushCb', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const job1 = () => {
|
|
|
|
calls.push('job1')
|
|
|
|
}
|
|
|
|
const cb1 = () => {
|
|
|
|
// queueJob in postFlushCb
|
|
|
|
calls.push('cb1')
|
|
|
|
queueJob(job1)
|
|
|
|
}
|
|
|
|
|
|
|
|
queuePostFlushCb(cb1)
|
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['cb1', 'job1'])
|
|
|
|
})
|
|
|
|
|
|
|
|
it('queueJob & postFlushCb inside postFlushCb', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const job1 = () => {
|
|
|
|
calls.push('job1')
|
|
|
|
}
|
|
|
|
const cb1 = () => {
|
|
|
|
calls.push('cb1')
|
|
|
|
queuePostFlushCb(cb2)
|
|
|
|
// job1 will executed before cb2
|
|
|
|
// Job has higher priority than postFlushCb
|
|
|
|
queueJob(job1)
|
|
|
|
}
|
|
|
|
const cb2 = () => {
|
|
|
|
calls.push('cb2')
|
|
|
|
}
|
|
|
|
|
|
|
|
queuePostFlushCb(cb1)
|
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['cb1', 'job1', 'cb2'])
|
|
|
|
})
|
|
|
|
|
|
|
|
it('postFlushCb inside queueJob', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const job1 = () => {
|
|
|
|
calls.push('job1')
|
|
|
|
// postFlushCb in queueJob
|
|
|
|
queuePostFlushCb(cb1)
|
|
|
|
}
|
|
|
|
const cb1 = () => {
|
|
|
|
calls.push('cb1')
|
|
|
|
}
|
|
|
|
|
|
|
|
queueJob(job1)
|
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['job1', 'cb1'])
|
|
|
|
})
|
|
|
|
|
|
|
|
it('queueJob & postFlushCb inside queueJob', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const job1 = () => {
|
|
|
|
calls.push('job1')
|
|
|
|
// cb1 will executed after job2
|
|
|
|
// Job has higher priority than postFlushCb
|
|
|
|
queuePostFlushCb(cb1)
|
|
|
|
queueJob(job2)
|
|
|
|
}
|
|
|
|
const job2 = () => {
|
|
|
|
calls.push('job2')
|
|
|
|
}
|
|
|
|
const cb1 = () => {
|
|
|
|
calls.push('cb1')
|
|
|
|
}
|
|
|
|
|
|
|
|
queueJob(job1)
|
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['job1', 'job2', 'cb1'])
|
|
|
|
})
|
|
|
|
|
|
|
|
it('nested queueJob w/ postFlushCb', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const job1 = () => {
|
|
|
|
calls.push('job1')
|
|
|
|
|
|
|
|
queuePostFlushCb(cb1)
|
|
|
|
queueJob(job2)
|
|
|
|
}
|
|
|
|
const job2 = () => {
|
|
|
|
calls.push('job2')
|
|
|
|
queuePostFlushCb(cb2)
|
|
|
|
}
|
|
|
|
const cb1 = () => {
|
|
|
|
calls.push('cb1')
|
|
|
|
}
|
|
|
|
const cb2 = () => {
|
|
|
|
calls.push('cb2')
|
|
|
|
}
|
|
|
|
|
|
|
|
queueJob(job1)
|
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['job1', 'job2', 'cb1', 'cb2'])
|
|
|
|
})
|
|
|
|
})
|
2020-02-11 02:09:15 +08:00
|
|
|
|
|
|
|
test('invalidateJob', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const job1 = () => {
|
|
|
|
calls.push('job1')
|
|
|
|
invalidateJob(job2)
|
|
|
|
job2()
|
|
|
|
}
|
|
|
|
const job2 = () => {
|
|
|
|
calls.push('job2')
|
|
|
|
}
|
2020-02-11 20:30:25 +08:00
|
|
|
const job3 = () => {
|
|
|
|
calls.push('job3')
|
|
|
|
}
|
|
|
|
const job4 = () => {
|
|
|
|
calls.push('job4')
|
|
|
|
}
|
|
|
|
// queue all jobs
|
2020-02-11 02:09:15 +08:00
|
|
|
queueJob(job1)
|
|
|
|
queueJob(job2)
|
2020-02-11 20:30:25 +08:00
|
|
|
queueJob(job3)
|
|
|
|
queuePostFlushCb(job4)
|
2020-02-11 02:09:15 +08:00
|
|
|
expect(calls).toEqual([])
|
|
|
|
await nextTick()
|
|
|
|
// job2 should be called only once
|
2020-02-11 20:30:25 +08:00
|
|
|
expect(calls).toEqual(['job1', 'job2', 'job3', 'job4'])
|
2020-02-11 02:09:15 +08:00
|
|
|
})
|
2020-04-15 05:31:35 +08:00
|
|
|
|
|
|
|
test('sort job based on id', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const job1 = () => calls.push('job1')
|
|
|
|
// job1 has no id
|
|
|
|
const job2 = () => calls.push('job2')
|
|
|
|
job2.id = 2
|
|
|
|
const job3 = () => calls.push('job3')
|
|
|
|
job3.id = 1
|
|
|
|
|
|
|
|
queueJob(job1)
|
|
|
|
queueJob(job2)
|
|
|
|
queueJob(job3)
|
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['job3', 'job2', 'job1'])
|
|
|
|
})
|
2020-07-16 10:36:41 +08:00
|
|
|
|
2020-08-14 21:50:23 +08:00
|
|
|
test('sort SchedulerCbs based on id', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const cb1 = () => calls.push('cb1')
|
|
|
|
// cb1 has no id
|
|
|
|
const cb2 = () => calls.push('cb2')
|
|
|
|
cb2.id = 2
|
|
|
|
const cb3 = () => calls.push('cb3')
|
|
|
|
cb3.id = 1
|
|
|
|
|
|
|
|
queuePostFlushCb(cb1)
|
|
|
|
queuePostFlushCb(cb2)
|
|
|
|
queuePostFlushCb(cb3)
|
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['cb3', 'cb2', 'cb1'])
|
|
|
|
})
|
|
|
|
|
2020-07-16 10:36:41 +08:00
|
|
|
// #1595
|
|
|
|
test('avoid duplicate postFlushCb invocation', async () => {
|
|
|
|
const calls: string[] = []
|
|
|
|
const cb1 = () => {
|
|
|
|
calls.push('cb1')
|
|
|
|
queuePostFlushCb(cb2)
|
|
|
|
}
|
|
|
|
const cb2 = () => {
|
|
|
|
calls.push('cb2')
|
|
|
|
}
|
|
|
|
queuePostFlushCb(cb1)
|
|
|
|
queuePostFlushCb(cb2)
|
|
|
|
await nextTick()
|
|
|
|
expect(calls).toEqual(['cb1', 'cb2'])
|
|
|
|
})
|
2020-07-28 12:20:30 +08:00
|
|
|
|
|
|
|
test('nextTick should capture scheduler flush errors', async () => {
|
|
|
|
const err = new Error('test')
|
|
|
|
queueJob(() => {
|
|
|
|
throw err
|
|
|
|
})
|
|
|
|
try {
|
|
|
|
await nextTick()
|
2021-09-02 21:53:57 +08:00
|
|
|
} catch (e: any) {
|
2020-07-28 12:20:30 +08:00
|
|
|
expect(e).toBe(err)
|
|
|
|
}
|
|
|
|
expect(
|
|
|
|
`Unhandled error during execution of scheduler flush`
|
|
|
|
).toHaveBeenWarned()
|
2020-07-31 05:54:05 +08:00
|
|
|
|
|
|
|
// this one should no longer error
|
|
|
|
await nextTick()
|
|
|
|
})
|
|
|
|
|
|
|
|
test('should prevent self-triggering jobs by default', async () => {
|
|
|
|
let count = 0
|
|
|
|
const job = () => {
|
|
|
|
if (count < 3) {
|
|
|
|
count++
|
|
|
|
queueJob(job)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
queueJob(job)
|
|
|
|
await nextTick()
|
|
|
|
// only runs once - a job cannot queue itself
|
|
|
|
expect(count).toBe(1)
|
|
|
|
})
|
|
|
|
|
2020-08-14 05:27:14 +08:00
|
|
|
test('should allow explicitly marked jobs to trigger itself', async () => {
|
2020-07-31 05:54:05 +08:00
|
|
|
// normal job
|
|
|
|
let count = 0
|
|
|
|
const job = () => {
|
|
|
|
if (count < 3) {
|
|
|
|
count++
|
|
|
|
queueJob(job)
|
|
|
|
}
|
|
|
|
}
|
2020-08-14 05:27:14 +08:00
|
|
|
job.allowRecurse = true
|
2020-07-31 05:54:05 +08:00
|
|
|
queueJob(job)
|
|
|
|
await nextTick()
|
|
|
|
expect(count).toBe(3)
|
|
|
|
|
|
|
|
// post cb
|
|
|
|
const cb = () => {
|
|
|
|
if (count < 5) {
|
|
|
|
count++
|
|
|
|
queuePostFlushCb(cb)
|
|
|
|
}
|
|
|
|
}
|
2020-08-14 05:27:14 +08:00
|
|
|
cb.allowRecurse = true
|
2020-07-31 05:54:05 +08:00
|
|
|
queuePostFlushCb(cb)
|
|
|
|
await nextTick()
|
|
|
|
expect(count).toBe(5)
|
2020-07-28 12:20:30 +08:00
|
|
|
})
|
2020-08-04 05:19:06 +08:00
|
|
|
|
2020-08-25 06:46:53 +08:00
|
|
|
// #1947 flushPostFlushCbs should handle nested calls
|
|
|
|
// e.g. app.mount inside app.mount
|
|
|
|
test('flushPostFlushCbs', async () => {
|
|
|
|
let count = 0
|
|
|
|
|
|
|
|
const queueAndFlush = (hook: Function) => {
|
|
|
|
queuePostFlushCb(hook)
|
|
|
|
flushPostFlushCbs()
|
|
|
|
}
|
|
|
|
|
|
|
|
queueAndFlush(() => {
|
|
|
|
queueAndFlush(() => {
|
|
|
|
count++
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
await nextTick()
|
|
|
|
expect(count).toBe(1)
|
|
|
|
})
|
2021-05-28 08:53:21 +08:00
|
|
|
|
|
|
|
// #910
|
|
|
|
test('should not run stopped reactive effects', async () => {
|
|
|
|
const spy = jest.fn()
|
|
|
|
|
|
|
|
// simulate parent component that toggles child
|
|
|
|
const job1 = () => {
|
2021-06-25 05:44:32 +08:00
|
|
|
// @ts-ignore
|
|
|
|
job2.active = false
|
2021-05-28 08:53:21 +08:00
|
|
|
}
|
|
|
|
// simulate child that's triggered by the same reactive change that
|
|
|
|
// triggers its toggle
|
2021-06-25 05:44:32 +08:00
|
|
|
const job2 = () => spy()
|
|
|
|
expect(spy).toHaveBeenCalledTimes(0)
|
2021-05-28 08:53:21 +08:00
|
|
|
|
|
|
|
queueJob(job1)
|
|
|
|
queueJob(job2)
|
|
|
|
await nextTick()
|
|
|
|
|
2021-06-25 05:44:32 +08:00
|
|
|
// should not be called
|
|
|
|
expect(spy).toHaveBeenCalledTimes(0)
|
2021-05-28 08:53:21 +08:00
|
|
|
})
|
2019-11-17 05:32:06 +08:00
|
|
|
})
|