Skip to content

Commit f82eb04

Browse files
Use split instead of regex to prevent non-deterministic behavior
Like the previous commit, it fails for a path configuration as default
1 parent 4ac5076 commit f82eb04

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/tests.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ test('expires option as fraction of a day', function () {
137137
expect(1);
138138

139139
var now = new Date().getTime();
140-
var expires = Date.parse(Cookies.set('c', 'v', { expires: 0.5 }).replace(/.+expires=/, ''));
140+
var stringifiedDate = Cookies.set('c', 'v', { expires: 0.5 }).split('; ')[1].split('=')[1];
141+
var expires = Date.parse(stringifiedDate);
141142

142143
// When we were using Date.setDate() fractions have been ignored
143144
// and expires resulted in the current date. Allow 1000 milliseconds

0 commit comments

Comments
 (0)