Last active
June 1, 2016 01:36
-
-
Save hbarcelos/8889a9bca790564c47a0c98c474c9c72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var chai = require('chai'), | |
expect = chai.expect, | |
should = chai.should(); | |
var RoundQueue = require('<round-queue-implementation>'); // We'll fix this later | |
describe('Round-Queue', function(){ | |
describe('When adding elements', function(){ | |
it('Should add an element to the end of a non-full queue', function() { | |
// Queue with max size of 3 | |
var nonFullQueue = new RoundQueue(3); | |
var originalSize = nonFullQueue.size; | |
var poppedElement = nonFullQueue.push(1); | |
// When the queue is not full, no popping will be done | |
expect(poppedElement).to.be.undefined; | |
// Element should've been added to the end of the queue | |
nonFullQueue.last().should.be.equal(1) | |
// Size should've been increased by 1 | |
nonFullQueue.size.should.be.equal(originalSize + 1); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment