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