Skip to content

Commit

Permalink
Merge pull request #430 from nicksay/timing-test-resolution
Browse files Browse the repository at this point in the history
Improve test reliability on platforms with clock skew
  • Loading branch information
nicksay authored Dec 15, 2016
2 parents eac1c97 + 3d608ce commit cf845f8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/client/cache/cache_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('spf.cache', function() {
time = { advance: 0 };
spf.__now = spf.now;
spf.now = function() {
return (+new Date()) + time.advance;
return (new Date()).getTime() + time.advance;
};
// Reset.
storage = spf.cache.storage_();
Expand Down
2 changes: 1 addition & 1 deletion src/client/history/history_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('spf.history', function() {
time = { advance: 0 };
spf.__now = spf.now;
spf.now = function() {
return (+new Date()) + time.advance;
return (new Date()).getTime() + time.advance;
};
// Init.
callbacks = {
Expand Down
4 changes: 2 additions & 2 deletions src/client/nav/request_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ describe('spf.nav.request', function() {
it('regular: single, navigation timing', function() {
var url = '/page';
var text = '{}';
var startTime = new Date().getTime() - 1;
var startTime = spf.now() - 1;
var fake = createFakeRegularXHR(text);
spf.net.xhr.get = jasmine.createSpy('xhr.get').and.callFake(fake);

Expand All @@ -938,7 +938,7 @@ describe('spf.nav.request', function() {
it('cached: single, navigation timing', function() {
var url = '/page';
var res = {'foo': 'FOO', 'bar': 'BAR'};
var startTime = new Date().getTime() - 1;
var startTime = spf.now() - 1;

var cacheKey = 'prefetch ' + spf.url.absolute(url);
var cacheObject = {
Expand Down

0 comments on commit cf845f8

Please sign in to comment.