Code coverage report for spec/algo/3-stacks/stackQueue.spec.js

Statements: 100% (31 / 31)      Branches: 100% (0 / 0)      Functions: 100% (8 / 8)      Lines: 100% (31 / 31)      Ignored: none     

All files » spec/algo/3-stacks/ » stackQueue.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 1   1 6     1 1 1     1 1 1     1 1 1 1     1 1 1 1     1 1 1 1     1 1 1 1 1    
var stackQueue = require("../../../lib/algorithms/3-stacks/stackQueue.js");
var stack = require("../../../lib/dataStructures/stack.js");
 
describe('When dealing with a Queue comprised of two stacks', function () {
 
    var queue;
 
    var testItem1 = 1;
    var testItem2 = 2;
 
    beforeEach(function() {
        queue = new stackQueue();
    });
 
    it('pushing to the Queue increases the length by 1', function () {
        queue.push(testItem1);
        expect(queue.length).toBe(1);
    });
 
    it('pushing to the Queue shows the item pushed with peek()', function () {
        queue.push(testItem1);
        expect(queue.peek()).toBe(testItem1);
    });
 
    it('pushing to the Queue then popping return the original item', function () {
        queue.push(testItem1);
        var result = queue.pop();
        expect(testItem1).toEqual(result);
    });
 
    it('pushing two items to the Queue increases the length by 2', function () {
        queue.push(testItem1);
        queue.push(testItem2);
        expect(queue.length).toBe(2);
    });
 
    it('pushing two items to the Queue shows the 1st item pushed with peek()', function () {
        queue.push(testItem1);
        queue.push(testItem2);
        expect(queue.peek()).toBe(testItem1);
    });
 
    it('pushing two items to the Queue then popping returns the 1st item', function () {
        queue.push(testItem1);
        queue.push(testItem2);
        var result = queue.pop();
        expect(testItem1).toEqual(result);
    });
});