Skip to content

Commit 3fcefa5

Browse files
committed
Make expires test agnostic to DST change
The test setup itself was assuming a different implementation. While `setDate()` will respect values causing the new date to overlap a DST change, e.g. adapt the hour accordingly, the underlying implementation does not. Therefore we need to set up the expected date to assert for differently, in line with the implementation that is.
1 parent 3138f58 commit 3fcefa5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/tests.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ QUnit.test('undefined', function (assert) {
180180

181181
QUnit.test('expires option as days from now', function (assert) {
182182
assert.expect(1);
183-
var expires = new Date();
184-
expires.setDate(expires.getDate() + 1);
183+
var days = 200;
184+
var expires = new Date(new Date().valueOf() + days * 24 * 60 * 60 * 1000);
185185
var expected = 'expires=' + expires.toUTCString();
186-
var actual = Cookies.set('c', 'v', { expires: 1 });
186+
var actual = Cookies.set('c', 'v', { expires: days });
187187
assert.ok(actual.indexOf(expected) !== -1, quoted(actual) + ' includes ' + quoted(expected));
188188
});
189189

0 commit comments

Comments
 (0)