Code coverage report for spec/dataStructures/stack.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/ » stack.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 501   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 stack = require("../../lib/dataStructures/stack.js");
 
describe('When pushing an element onto a stack', function () {
	var myStack;
	var firstValue = 1;
 
	beforeEach(function() {
		myStack = new stack();
		myStack.push(firstValue);
 
	});
 
	afterEach(function() {
		myStack = null;
	});
 
	it('the stacks` length should be 1', function () {
		expect(myStack.length).toBe(1);
	});
 
	it('peek should show the item', function() {
		expect(myStack.peek()).toBe(firstValue);
	});
 
});
 
describe('When the stack contains one element and your remove it', function () {
	var myStack;
	var testValue = 1;
 
	beforeEach(function() {
		myStack = new stack();
		myStack.push(testValue);
		myStack.pop(testValue);
 
	});
 
	afterEach(function() {
		myStack = null;
	});
 
	it('the stack`s length should be zero', function () {
		expect(myStack.length).toBe(0);
	});
 
	it('peek should be null', function() {
		expect(myStack.peek()).toBe(null);
	});
});