Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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
const priorityQueue = new PriorityQueue();
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
const priorityQueue = new PriorityQueue();
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)

AltStyle によって変換されたページ (->オリジナル) /