Skip to content

Commit 9e09613

Browse files
committed
revert Date.now in tests
1 parent c608285 commit 9e09613

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎test/unit/SigninResponse.spec.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,24 @@ describe("SigninResponse", function() {
8787

8888
describe("expires_in", function() {
8989
it("should calculate how much time left", function() {
90+
var oldNow = Date.now;
9091
Date.now = function() {
9192
return 1000 * 1000; // ms
9293
}
9394
let subject = new SigninResponse("expires_in=100");
9495
subject.expires_in.should.equal(100);
9596

9697
Date.now = function() {
97-
return 1050 * 1000;
98+
return 1050 * 1000; // ms
9899
}
99100
subject.expires_in.should.equal(50);
101+
Date.now = oldNow;
100102
});
101103
});
102104

103105
describe("expired", function() {
104106
it("should calculate how much time left", function() {
107+
var oldNow = Date.now;
105108
Date.now = function() {
106109
return 1000 * 1000; // ms
107110
}
@@ -112,6 +115,7 @@ describe("SigninResponse", function() {
112115
return 1100 * 1000; // ms
113116
}
114117
subject.expired.should.be.true;
118+
Date.now = oldNow;
115119
});
116120
});
117121

0 commit comments

Comments
 (0)