test: improve deque coverage
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 26 Aug 2023 20:36:32 +0000 (22:36 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 26 Aug 2023 20:36:32 +0000 (22:36 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
tests/deque.test.js

index 8521047d1ef7edc8aecc5eb5483c556d61b355e9..386b8ae1290c67e65b8191403f06d9bb21b666a0 100644 (file)
@@ -96,6 +96,22 @@ describe('Deque test suite', () => {
     expect(deque.tail).toBeUndefined()
   })
 
+  it('Verify peekFirst() behavior', () => {
+    const deque = new Deque()
+    deque.push(1)
+    deque.push(2)
+    deque.push(3)
+    expect(deque.peekFirst()).toBe(1)
+  })
+
+  it('Verify peekLast() behavior', () => {
+    const deque = new Deque()
+    deque.push(1)
+    deque.push(2)
+    deque.push(3)
+    expect(deque.peekLast()).toBe(3)
+  })
+
   it('Verify clear() behavior', () => {
     const deque = new Deque()
     deque.push(1)