Last active
October 9, 2020 19:21
-
-
Save anchnk/970f8b8a5e44776ce98c467f3c76c381 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const { SinglyLinkedList, Node } = require('./../interview'); | |
const assert = require('assert'); | |
describe('SingleLinkedList.reverse', function() { | |
let linkedList; | |
beforeEach(() => { | |
linkedList = new SinglyLinkedList(); | |
}); | |
it('should return an empty linked list when the list is empty', function() { | |
linkedList.reverse(); | |
assert.strictEqual(linkedList.length, 0) | |
}); | |
it('should return the same list when reverse() is called twice', function() { | |
linkedList.reverse(); | |
linkedList.reverse(); | |
// TODO | |
}); | |
it('should return the exact same linked list when the list has just 1 element', function() { | |
const node = new Node(1); | |
linkedList.add(node); | |
linkedList.reverse(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment