From: Evan You Date: Thu, 20 Sep 2018 01:38:27 +0000 (-0400) Subject: test: add dedupe test case for scheduler X-Git-Tag: v3.0.0-alpha.0~1234 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb982099e4400d246ec7aa367ad85c6ffc959bec;p=thirdparty%2Fvuejs%2Fcore.git test: add dedupe test case for scheduler --- diff --git a/packages/scheduler/__tests__/scheduler.spec.ts b/packages/scheduler/__tests__/scheduler.spec.ts index 60f4494bf9..27265c422d 100644 --- a/packages/scheduler/__tests__/scheduler.spec.ts +++ b/packages/scheduler/__tests__/scheduler.spec.ts @@ -77,4 +77,21 @@ describe('scheduler', () => { await nextTick() expect(calls).toEqual(['job1', 'job2', 'cb1', 'cb2']) }) + + test('should dedupe queued tasks', async () => { + const calls: any = [] + 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']) + }) })