Skip to content

Commit

Permalink
remove done call, as it is unnecessary now
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob M. Roufa committed May 13, 2015
1 parent 6f2fe36 commit 52faf47
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
15 changes: 15 additions & 0 deletions app/count.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ exports = (typeof window === 'undefined') ? global : window;

exports.countAnswers = {
count : function (start, end) {
var timeout;
function doIt () {
console.log(start++);

if (start <= end) {
timeout = setTimeout(doIt, 100);
}
}

doIt();

return {
cancel : function () {
timeout && clearTimeout(timeout);
}
};
}
};
7 changes: 2 additions & 5 deletions tests/app/count.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('counter', function () {
this.clock.restore();
});

it('should count from start number to end number, one per 1/10th of a second', function (done) {
it('should count from start number to end number, one per 1/10th of a second', function () {
this.timeout(600);
countAnswers.count(1, 5);

Expand All @@ -50,11 +50,9 @@ describe('counter', function () {
expect(nums.length).to.eql(5);
expect(nums[0]).to.eql(1);
expect(nums[4]).to.eql(5);

done();
});

it('should provide a method to cancel the counting', function (done) {
it('should provide a method to cancel the counting', function () {
this.timeout(600);

var counter = countAnswers.count(1, 5);
Expand All @@ -63,6 +61,5 @@ describe('counter', function () {
this.clock.tick(550);

expect(nums.length < 5).to.be.ok;
done();
});
});

0 comments on commit 52faf47

Please sign in to comment.