Skip to content

Commit 53d6237

Browse files
committed
test: add more queue.stop tests
1 parent 882b70c commit 53d6237

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/Queue.test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,24 @@ describe('Queue', () => {
119119
expect(taskSpy.callCount).to.eql(1)
120120
})
121121

122+
it('should not start again until start is called', async () => {
123+
const queue = new Queue(priorities.CRITICAL)
124+
const taskSpy = spy(() => {})
125+
queue.add(taskSpy)
126+
await queue.processing()
127+
expect(queue.size).to.eql(0)
128+
expect(taskSpy.callCount).to.eql(1)
129+
queue.stop()
130+
queue.add(taskSpy)
131+
await beforeNextFrame()
132+
expect(queue.size).to.eql(1)
133+
expect(taskSpy.callCount).to.eql(1)
134+
queue.start()
135+
await beforeNextFrame()
136+
expect(queue.size).to.eql(0)
137+
expect(taskSpy.callCount).to.eql(2)
138+
})
139+
122140
it('should have the same effect on multiple calls', async () => {
123141
const queue = new Queue(priorities.CRITICAL)
124142
const taskSpy = spy(() => {})

0 commit comments

Comments
 (0)