Skip to content

Commit 1520533

Browse files
committed
Fix issue trekhleb#315.
1 parent 2206158 commit 1520533

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎src/data-structures/priority-queue/__test__/PriorityQueue.test.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,16 @@ describe('PriorityQueue', () =>{
5151
expect(priorityQueue.poll()).toBe(5);
5252
});
5353

54-
it('should be possible to change priority of internal nodes',()=>{
54+
it('should be possible to change priority of head node',()=>{
5555
constpriorityQueue=newPriorityQueue();
5656

5757
priorityQueue.add(10,1);
5858
priorityQueue.add(5,2);
5959
priorityQueue.add(100,0);
6060
priorityQueue.add(200,0);
6161

62+
expect(priorityQueue.peek()).toBe(100);
63+
6264
priorityQueue.changePriority(100,10);
6365
priorityQueue.changePriority(10,20);
6466

@@ -68,14 +70,16 @@ describe('PriorityQueue', () =>{
6870
expect(priorityQueue.poll()).toBe(10);
6971
});
7072

71-
it('should be possible to change priority of head node',()=>{
73+
it('should be possible to change priority of internal nodes',()=>{
7274
constpriorityQueue=newPriorityQueue();
7375

7476
priorityQueue.add(10,1);
7577
priorityQueue.add(5,2);
7678
priorityQueue.add(100,0);
7779
priorityQueue.add(200,0);
7880

81+
expect(priorityQueue.peek()).toBe(100);
82+
7983
priorityQueue.changePriority(200,10);
8084
priorityQueue.changePriority(10,20);
8185

0 commit comments

Comments
(0)