Code coverage report for spec/dataStructures/minHeap.two.spec.js

Statements: 100% (15 / 15)      Branches: 100% (0 / 0)      Functions: 100% (6 / 6)      Lines: 100% (15 / 15)      Ignored: none     

All files » spec/dataStructures/ » minHeap.two.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 271   1 1   1 3 3 3     1 3     1 1     1 1     1 1    
var minHeap = require("../../lib/dataStructures/minHeap.js");
 
describe('When adding two elements to the min heap', function () {
	var list;
 
	beforeEach(function() {
		list = new minHeap();
		list.add(20);
		list.add(10);
	});
 
	afterEach(function() {
		list = null;
	});
 
	it('the minHeap length should by 2', function () {
		expect(list.array.length).toBe(2);
	});
 
	it('the 1st element of the minHeap should be the smallest value of the two.', function () {
		expect(list.array[0]).toBe(10);
	});
 
	it('and you remove the head, it should be the smallest element.', function () {
		expect(list.removeHead()).toBe(10);
	});
});