mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Merge pull request #2870 from halfdan/2776-can-haz-cookie
Fix 12h cookie test issue
This commit is contained in:
commit
1ae98df995
1 changed files with 13 additions and 4 deletions
|
@ -200,13 +200,22 @@ describe('Admin Routing', function () {
|
||||||
should.exist(res.headers['set-cookie']);
|
should.exist(res.headers['set-cookie']);
|
||||||
should.exist(res.headers.date);
|
should.exist(res.headers.date);
|
||||||
|
|
||||||
var expires;
|
var expires,
|
||||||
// Session should expire 12 hours after the time in the date header
|
dateAfter = moment.utc(res.headers.date).add('Hours', 12),
|
||||||
expires = moment.utc(res.headers.date).add('Hours', 12).format("ddd, DD MMM YYYY HH:mm");
|
match,
|
||||||
expires = new RegExp("Expires=" + expires);
|
expireDate;
|
||||||
|
|
||||||
|
expires = new RegExp("Expires=(.*);");
|
||||||
|
|
||||||
res.headers['set-cookie'].should.match(expires);
|
res.headers['set-cookie'].should.match(expires);
|
||||||
|
|
||||||
|
match = String(res.headers['set-cookie']).match(expires);
|
||||||
|
|
||||||
|
expireDate = moment.utc(new Date(match[1]));
|
||||||
|
|
||||||
|
// The expire date should be about 12 hours after the request
|
||||||
|
expireDate.diff(dateAfter).should.be.below(2500);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue