Skip to content

Instantly share code, notes, and snippets.

@anchnk
Last active October 9, 2020 19:21
Show Gist options
  • Save anchnk/970f8b8a5e44776ce98c467f3c76c381 to your computer and use it in GitHub Desktop.
Save anchnk/970f8b8a5e44776ce98c467f3c76c381 to your computer and use it in GitHub Desktop.
'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