-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* upgrading deps * build fix * fixing tests * improving coverage
- Loading branch information
Showing
15 changed files
with
2,431 additions
and
3,729 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Queue } from './queue'; | ||
|
||
describe('Queue', () => { | ||
it('should initialize with size 0', () => { | ||
const queue = new Queue<number>(); | ||
expect(queue.getSize()).toBe(0); | ||
expect(queue.isEmpty()).toBe(true); | ||
}); | ||
|
||
it('should enqueue items and update size', () => { | ||
const queue = new Queue<number>(); | ||
queue.enqueue(1); | ||
expect(queue.getSize()).toBe(1); | ||
expect(queue.isEmpty()).toBe(false); | ||
queue.enqueue(2); | ||
expect(queue.getSize()).toBe(2); | ||
}); | ||
|
||
it('should dequeue items in the correct order', () => { | ||
const queue = new Queue<number>(); | ||
queue.enqueue(1); | ||
queue.enqueue(2); | ||
expect(queue.dequeue()).toBe(1); | ||
expect(queue.getSize()).toBe(1); | ||
expect(queue.dequeue()).toBe(2); | ||
expect(queue.getSize()).toBe(0); | ||
expect(queue.isEmpty()).toBe(true); | ||
}); | ||
|
||
it('should return null when dequeue is called on an empty queue', () => { | ||
const queue = new Queue<number>(); | ||
expect(queue.dequeue()).toBeNull(); | ||
}); | ||
|
||
it('should handle enqueue and dequeue operations correctly', () => { | ||
const queue = new Queue<number>(); | ||
queue.enqueue(1); | ||
queue.enqueue(2); | ||
queue.enqueue(3); | ||
expect(queue.dequeue()).toBe(1); | ||
queue.enqueue(4); | ||
expect(queue.dequeue()).toBe(2); | ||
expect(queue.dequeue()).toBe(3); | ||
expect(queue.dequeue()).toBe(4); | ||
expect(queue.isEmpty()).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.