Skip to content

Commit

Permalink
feature: added length property
Browse files Browse the repository at this point in the history
  • Loading branch information
hbarcelos committed Feb 5, 2020
1 parent c69968e commit 791b62c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions round-linked-queue.js
Expand Up @@ -3,11 +3,16 @@
class RoundLinkedQueue {
constructor(maxLength) {
this._maxLength = maxLength;
this._length = 0;
}

get maxLength() {
return this._maxLength;
}

get length() {
return this._length;
}
}

module.exports = RoundLinkedQueue;
8 changes: 8 additions & 0 deletions round-linked-queue.test.js
Expand Up @@ -12,5 +12,13 @@ describe("Round-Queue", () => {

expect(queue.maxLength).to.equal(queueLength);
});

it("Should initially set the length to zero", () => {
const queueLength = 3;

const queue = new RoundQueue(queueLength);

expect(queue.length).to.equal(0);
});
});
});

0 comments on commit 791b62c

Please sign in to comment.