Tests/LibWeb: Prevent inadvertent cookie expiration
We were testing cookie expiry by setting moving a Date 1000ms to the future, and then calling `.toUTCString()` on it. However, that method truncates milliseconds and could cause the actual expiry to be almost immediately - that makes this test flaky, especially on slower machines. Fix the issue by using a larger expiry.
This commit is contained in:
parent
943319453d
commit
f326f087fa
1 changed files with 2 additions and 2 deletions
|
|
@ -140,13 +140,13 @@
|
|||
};
|
||||
|
||||
const expiresTest = () => {
|
||||
let expiry = new Date(Date.now() + 1000);
|
||||
let expiry = new Date(Date.now() + 3000);
|
||||
expiry = expiry.toUTCString();
|
||||
|
||||
document.cookie = `cookie-expires=value; expires=${expiry}`;
|
||||
printCookies("Expires (before expiration)");
|
||||
|
||||
internals.expireCookiesWithTimeOffset(2);
|
||||
internals.expireCookiesWithTimeOffset(4);
|
||||
printCookies("Expires (after expiration)");
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue