diff --git a/src/data-structures/priority-queue/__test__/PriorityQueue.test.js b/src/data-structures/priority-queue/__test__/PriorityQueue.test.js index e593965cc4..2ffe4acb74 100644 --- a/src/data-structures/priority-queue/__test__/PriorityQueue.test.js +++ b/src/data-structures/priority-queue/__test__/PriorityQueue.test.js @@ -51,7 +51,7 @@ describe('PriorityQueue', () => { expect(priorityQueue.poll()).toBe(5); }); - it('should be possible to change priority of internal nodes', () => { + it('should be possible to change priority of head node', () => { const priorityQueue = new PriorityQueue(); priorityQueue.add(10, 1); @@ -59,6 +59,8 @@ describe('PriorityQueue', () => { priorityQueue.add(100, 0); priorityQueue.add(200, 0); + expect(priorityQueue.peek()).toBe(100); + priorityQueue.changePriority(100, 10); priorityQueue.changePriority(10, 20); @@ -68,7 +70,7 @@ describe('PriorityQueue', () => { expect(priorityQueue.poll()).toBe(10); }); - it('should be possible to change priority of head node', () => { + it('should be possible to change priority of internal nodes', () => { const priorityQueue = new PriorityQueue(); priorityQueue.add(10, 1); @@ -76,6 +78,8 @@ describe('PriorityQueue', () => { priorityQueue.add(100, 0); priorityQueue.add(200, 0); + expect(priorityQueue.peek()).toBe(100); + priorityQueue.changePriority(200, 10); priorityQueue.changePriority(10, 20);