Skip to content

Commit f43aecb

Browse files
Let's keep this test atomic and remove all cookies
They are not removed in the normal removal operation after each test because the path is set with a different value. To remove a cookie it is necessary to pass the same path that the cookie was created with.
1 parent 740f65b commit f43aecb

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎test/tests.js‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,15 @@ test('return value', function () {
164164

165165
test('defaults', function () {
166166
expect(2);
167+
167168
Cookies.defaults.path = '/foo';
168-
ok(Cookies.set('c', 'v').match(/path=\/foo/), 'should use options from defaults');
169-
ok(Cookies.set('c', 'v', { path: '/bar' }).match(/path=\/bar/), 'options argument has precedence');
169+
ok(Cookies.set('c', 'v').match(/path=\/foo/), 'should use attributes from defaults');
170+
Cookies.remove( 'c', { path: '/foo' });
171+
172+
ok(Cookies.set('c', 'v', { path: '/bar' }).match(/path=\/bar/), 'attributes argument has precedence');
173+
Cookies.remove( 'c', { path: '/bar' });
174+
175+
delete Cookies.defaults.path;
170176
});
171177

172178
module('remove', lifecycle);

0 commit comments

Comments
 (0)