Code coverage report for spec/dataStructures/linkedList.one.spec.js

Statements: 100% (34 / 34)      Branches: 100% (0 / 0)      Functions: 100% (14 / 14)      Lines: 100% (34 / 34)      Ignored: none     

All files » spec/dataStructures/ » linkedList.one.spec.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 651   1 1 1   1 5 5       1 5     1 1     1 1     1 1     1 1     1 1       1 1 1   1 3 3 3       1 3     1 1     1 1     1 1      
var LinkedList = require("../../lib/dataStructures/linkedList.js");
 
describe('When adding one element to a linked list', function () {
	var list;
	var testValue = "test_string"
 
	beforeEach(function() {
		list = new LinkedList();
		list.add(testValue);
 
	});
 
	afterEach(function() {
		list = null;
	});
 
	it('the lists length should increase by 1', function () {
		expect(list.length).toBe(1);
	});
 
	it('the start element should contain the added value.', function () {
		expect(list.start.data).toBe(testValue);
	});
 
	it('the end element should contain the added value.', function () {
		expect(list.end.data).toBe(testValue);
	});
 
	it('the start next pointer should be null.', function () {
		expect(list.start.next).toBe(null);
	});
 
	it('the end next pointer should be null.', function () {
		expect(list.end.next).toBe(null);
	});
});
 
describe('When the list contains one element and your remove it', function () {
	var list;
	var testValue = "test_string"
 
	beforeEach(function() {
		list = new LinkedList();
		list.add(testValue);
		list.remove(testValue);
 
	});
 
	afterEach(function() {
		list = null;
	});
 
	it('the lists length should be zero', function () {
		expect(list.length).toBe(0);
	});
 
	it('the start element should be null', function () {
		expect(list.start).toBe(null);
	});
 
	it('the end element should be null', function () {
		expect(list.end).toBe(null);
	});
});