mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2026-03-13 15:21:15 +08:00
fix error in SinglyLinkedList head method (#1322)
* fix error in SinglyLinkedList head method * test: update check head test for SinglyLinkedList * fix: code style error * fix: remove extra semicolons --------- Co-authored-by: Bekzod <bekzodisakov18@gmail.com>
This commit is contained in:
@@ -148,6 +148,10 @@ describe('SinglyLinkedList', () => {
|
||||
|
||||
list.addFirst(30)
|
||||
expect(list.head()).toBe(30)
|
||||
|
||||
// check for a falsy head data
|
||||
list.addFirst(false)
|
||||
expect(list.head()).toBe(false)
|
||||
})
|
||||
|
||||
it('Check tail', () => {
|
||||
@@ -162,6 +166,10 @@ describe('SinglyLinkedList', () => {
|
||||
|
||||
list.addFirst(30)
|
||||
expect(list.tail()).toBe(20)
|
||||
|
||||
// check for a falsy tail data
|
||||
list.addLast(false)
|
||||
expect(list.tail()).toBe(false)
|
||||
})
|
||||
|
||||
it('Check size', () => {
|
||||
|
||||
Reference in New Issue
Block a user