Skip to content

Error in 01-singly-linked-list-spec.js #3

Description

@doo1y

The spec for the removeFromTail method seems to have an error.

This Mocha frame (line 199 - 206):
it('Should reassign the new tail\'s next pointer to null', () => { linkedList.addToTail('A'); linkedList.addToTail('B'); linkedList.addToTail('C'); expect(linkedList.head.next.next).to.eql({ value: 'C', next: null }); linkedList.removeFromTail(); expect(linkedList.head.next.next).to.eql(null); });
specifically the assertions from line 203 to line 205; if the 'C' node's next value is NULL, calling the linkedList.removeFromTail() method would .pop() the 'C' node from the linked list and assign the 'B' node's next value NULL. The last assertion expect(linkedList.head.next.next).to.eql(null);

ex.
[original]: A(.next.next.next = null) -> B(.next.next = null) -> C(.next = null) -> null
[tail removed]: A(.next.next = null) -> B(.next = null) -> null -> ???

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions