Skip to content

Commit 96be45f

Browse files
committed
added 'check tail' test
1 parent 7d1e46a commit 96be45f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Data-Structures/Linked-List/test/SinglyLinkedList.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,20 @@ describe('SinglyLinkedList', () => {
150150
expect(list.head()).toBe(30)
151151
})
152152

153+
it('Check tail', () => {
154+
const list = new LinkedList()
155+
expect(list.tail()).toBe(null)
156+
157+
list.addLast(10)
158+
expect(list.tail()).toBe(10)
159+
160+
list.addLast(20)
161+
expect(list.tail()).toBe(20)
162+
163+
list.addFirst(30)
164+
expect(list.tail()).toBe(20)
165+
})
166+
153167
it('Check size', () => {
154168
const list = new LinkedList()
155169
expect(list.size()).toBe(0)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy