Skip to content

Commit

Permalink
Fix session expiration test (#7208)
Browse files Browse the repository at this point in the history
* Fix session expiration test

* Fix the other test with similar issue

* Remove fit
  • Loading branch information
davimacedo authored Feb 19, 2021
1 parent 5a09687 commit fba096a
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions spec/rest.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,7 @@ describe('rest create', () => {
const actual = new Date(session.expiresAt.iso);
const expected = new Date(now.getTime() + 1000 * 3600 * 24 * 365);

expect(actual.getFullYear()).toEqual(expected.getFullYear());
expect(actual.getMonth()).toEqual(expected.getMonth());
expect(actual.getDate()).toEqual(expected.getDate());
// less than a minute, if test happen at the wrong time :/
expect(actual.getMinutes() - expected.getMinutes() <= 1).toBe(true);
expect(Math.abs(actual - expected) <= jasmine.DEFAULT_TIMEOUT_INTERVAL).toEqual(true);

done();
});
Expand Down Expand Up @@ -595,11 +591,7 @@ describe('rest create', () => {
const actual = new Date(session.expiresAt.iso);
const expected = new Date(now.getTime() + sessionLength * 1000);

expect(actual.getFullYear()).toEqual(expected.getFullYear());
expect(actual.getMonth()).toEqual(expected.getMonth());
expect(actual.getDate()).toEqual(expected.getDate());
expect(actual.getHours()).toEqual(expected.getHours());
expect(actual.getMinutes()).toEqual(expected.getMinutes());
expect(Math.abs(actual - expected) <= jasmine.DEFAULT_TIMEOUT_INTERVAL).toEqual(true);

done();
})
Expand Down

0 comments on commit fba096a

Please sign in to comment.