@@ -51,14 +51,16 @@ describe('PriorityQueue', () =>{
5151expect ( 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 ' , ( ) => {
5555const priorityQueue = new PriorityQueue ( ) ;
5656
5757priorityQueue . add ( 10 , 1 ) ;
5858priorityQueue . add ( 5 , 2 ) ;
5959priorityQueue . add ( 100 , 0 ) ;
6060priorityQueue . add ( 200 , 0 ) ;
6161
62+ expect ( priorityQueue . peek ( ) ) . toBe ( 100 ) ;
63+
6264priorityQueue . changePriority ( 100 , 10 ) ;
6365priorityQueue . changePriority ( 10 , 20 ) ;
6466
@@ -68,14 +70,16 @@ describe('PriorityQueue', () =>{
6870expect ( 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 ' , ( ) => {
7274const priorityQueue = new PriorityQueue ( ) ;
7375
7476priorityQueue . add ( 10 , 1 ) ;
7577priorityQueue . add ( 5 , 2 ) ;
7678priorityQueue . add ( 100 , 0 ) ;
7779priorityQueue . add ( 200 , 0 ) ;
7880
81+ expect ( priorityQueue . peek ( ) ) . toBe ( 100 ) ;
82+
7983priorityQueue . changePriority ( 200 , 10 ) ;
8084priorityQueue . changePriority ( 10 , 20 ) ;
8185
0 commit comments