Skip to content

Commit

Permalink
Chore: Round timer values to integers (#786)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Press authored Apr 27, 2018
1 parent 65ec0b5 commit 740181c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib/Timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Timer {
}

time.end = global.performance.now();
time.elapsed = time.end - time.start;
time.elapsed = Math.round(time.end - time.start);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/lib/__tests__/Timer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ describe('lib/Timer', () => {

it('should set the end prop, and calculate the elapsed time', () => {
sandbox.stub(global.performance, 'now').returns(5);
Timer.times[tag] = { start: 3 };
Timer.times[tag] = { start: 3.5 };

Timer.stop(tag);
expect(Timer.get(tag).elapsed).to.equal(2); // 5 - 3 = 2
expect(Timer.get(tag).elapsed).to.equal(2); // 5 - 3.5 = 1.5, rounded = 2
});
});

Expand Down

0 comments on commit 740181c

Please sign in to comment.