@@ -216,36 +216,36 @@ test("set_internal isn't affected by defaults", () => {
216
216
217
217
test ( 'reproduce issue #13947: multiple cookies with same name but different paths' , ( ) => {
218
218
const { cookies } = cookies_setup ( ) ;
219
-
219
+
220
220
// Set two cookies with the same name but different paths
221
221
cookies . set ( 'key' , 'value1' , { path : '/foo' } ) ;
222
222
cookies . set ( 'key' , 'value2' , { path : '/bar' } ) ;
223
-
223
+
224
224
// Both cookies should be accessible by specifying their path
225
225
expect ( cookies . get ( 'key' , { path : '/foo' } ) ) . toEqual ( 'value1' ) ;
226
226
expect ( cookies . get ( 'key' , { path : '/bar' } ) ) . toEqual ( 'value2' ) ;
227
227
} ) ;
228
228
229
229
test ( 'cookies with same name but different domains' , ( ) => {
230
230
const { cookies } = cookies_setup ( ) ;
231
-
231
+
232
232
// Set two cookies with the same name but different domains
233
233
cookies . set ( 'key' , 'value1' , { path : '/' , domain : 'example.com' } ) ;
234
234
cookies . set ( 'key' , 'value2' , { path : '/' , domain : 'sub.example.com' } ) ;
235
-
235
+
236
236
// Both cookies should be accessible by specifying their domain
237
237
expect ( cookies . get ( 'key' , { domain : 'example.com' , path : '/' } ) ) . toEqual ( 'value1' ) ;
238
238
expect ( cookies . get ( 'key' , { domain : 'sub.example.com' , path : '/' } ) ) . toEqual ( 'value2' ) ;
239
239
} ) ;
240
240
241
241
test ( 'cookies with same name but different domain and path combinations' , ( ) => {
242
242
const { cookies } = cookies_setup ( ) ;
243
-
243
+
244
244
// Set cookies with same name but different domain/path combinations
245
245
cookies . set ( 'key' , 'value1' , { path : '/foo' , domain : 'example.com' } ) ;
246
246
cookies . set ( 'key' , 'value2' , { path : '/bar' , domain : 'example.com' } ) ;
247
247
cookies . set ( 'key' , 'value3' , { path : '/foo' , domain : 'sub.example.com' } ) ;
248
-
248
+
249
249
// All cookies should be accessible by specifying their domain and path
250
250
expect ( cookies . get ( 'key' , { domain : 'example.com' , path : '/foo' } ) ) . toEqual ( 'value1' ) ;
251
251
expect ( cookies . get ( 'key' , { domain : 'example.com' , path : '/bar' } ) ) . toEqual ( 'value2' ) ;
@@ -254,28 +254,28 @@ test('cookies with same name but different domain and path combinations', () =>
254
254
255
255
test ( 'backward compatibility: get without domain/path options still works' , ( ) => {
256
256
const { cookies } = cookies_setup ( ) ;
257
-
257
+
258
258
// Set a cookie the old way
259
259
cookies . set ( 'old-style' , 'value' , { path : '/' } ) ;
260
-
260
+
261
261
// Should be retrievable without specifying path
262
262
expect ( cookies . get ( 'old-style' ) ) . toEqual ( 'value' ) ;
263
263
} ) ;
264
264
265
265
test ( 'get with only path specified (no domain)' , ( ) => {
266
266
const { cookies } = cookies_setup ( ) ;
267
-
267
+
268
268
cookies . set ( 'key' , 'value' , { path : '/test' } ) ;
269
-
269
+
270
270
// Should be retrievable by path only
271
271
expect ( cookies . get ( 'key' , { path : '/test' } ) ) . toEqual ( 'value' ) ;
272
272
} ) ;
273
273
274
274
test ( 'get with only domain specified (no path)' , ( ) => {
275
275
const { cookies } = cookies_setup ( ) ;
276
-
276
+
277
277
cookies . set ( 'key' , 'value' , { path : '/' , domain : 'example.com' } ) ;
278
-
278
+
279
279
// Should be retrievable by domain only (path defaults to current URL path)
280
280
expect ( cookies . get ( 'key' , { domain : 'example.com' } ) ) . toEqual ( 'value' ) ;
281
281
} ) ;
0 commit comments