Skip to content

Commit

Permalink
Fix issue trekhleb#315.
Browse files Browse the repository at this point in the history
  • Loading branch information
trekhleb committed Apr 12, 2019
1 parent 2206158 commit 1520533
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ 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);
priorityQueue.add(5, 2);
priorityQueue.add(100, 0);
priorityQueue.add(200, 0);

expect(priorityQueue.peek()).toBe(100);

priorityQueue.changePriority(100, 10);
priorityQueue.changePriority(10, 20);

Expand All @@ -68,14 +70,16 @@ 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);
priorityQueue.add(5, 2);
priorityQueue.add(100, 0);
priorityQueue.add(200, 0);

expect(priorityQueue.peek()).toBe(100);

priorityQueue.changePriority(200, 10);
priorityQueue.changePriority(10, 20);

Expand Down

0 comments on commit 1520533

Please sign in to comment.