Skip to content

Commit 42b8013

Browse files
authored
Remove usages of toArray in other tests
1 parent ab99a65 commit 42b8013

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,35 @@ describe('CircularDoublyLinkedList', () => {
1212
return list
1313
}
1414

15+
const expectList = (list, expected) => expect([...list.elements()]).toEqual(expected)
16+
1517
it('append', () => {
1618
const list = createAndAppend([1])
1719

18-
expect(list.toArray()).toEqual([1])
20+
expectList(list, [1])
1921

2022
list.append(2)
21-
expect(list.toArray()).toEqual([1, 2])
23+
expectList(list, [1, 2])
2224
})
2325

2426
it('insert', () => {
2527
const list = createAndAppend([1])
2628

2729
list.insert(0, 20)
28-
expect(list.toArray()).toEqual([20, 1])
30+
expectList(list, [20, 1])
2931

3032
list.insert(1, 30)
31-
expect(list.toArray()).toEqual([20, 30, 1])
33+
expectList(list, [20, 30, 1])
3234
})
3335

3436
it('removeAt', () => {
3537
const list = createAndAppend([10, 40, 30])
3638

3739
list.removeAt(0)
38-
expect(list.toArray()).toEqual([40, 30])
40+
expectList(list, [40, 30])
3941

4042
list.removeAt(1)
41-
expect(list.toArray()).toEqual([40])
43+
expectList(list, [40])
4244
})
4345

4446
it('elements', () => {

0 commit comments

Comments
 (0)