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

Statements: 100% (26 / 26)      Branches: 100% (0 / 0)      Functions: 100% (10 / 10)      Lines: 100% (26 / 26)      Ignored: none     

All files » spec/dataStructures/ » queue.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 491   1 1 1   1 2 2     1 2     1 1     1 1         1 1 1   1 2 2 2       1 2     1 1     1 1      
var Queue = require("../../lib/dataStructures/queue.js");
 
describe('When adding an element onto a Queue', function () {
	var myQueue;
	var firstValue = 1;
 
	beforeEach(function() {
		myQueue = new Queue();
		myQueue.add(firstValue);
	});
 
	afterEach(function() {
		myQueue = null;
	});
 
	it('the Queues` length should be 1', function () {
		expect(myQueue.length).toBe(1);
	});
 
	it('peek should show the item', function() {
		expect(myQueue.peek()).toBe(firstValue);
	});
 
});
 
describe('When the Queue contains one element and your remove it', function () {
	var myQueue;
	var testValue = 1;
 
	beforeEach(function() {
		myQueue = new Queue();
		myQueue.add(testValue);
		myQueue.remove(testValue);
 
	});
 
	afterEach(function() {
		myQueue = null;
	});
 
	it('the Queue`s length should be zero', function () {
		expect(myQueue.length).toBe(0);
	});
 
	it('peek should be null', function() {
		expect(myQueue.peek()).toBe(null);
	});
});