Skip to content

Commit bf15611

Browse files
Do the same as the previous commit but now for the cookie name
1 parent 5c70ff3 commit bf15611

1 file changed

Lines changed: 56 additions & 22 deletions

File tree

‎test/encoding.js‎

Lines changed: 56 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -219,103 +219,137 @@ test('cookie-value - 4 bytes character (𩸽)', function () {
219219

220220
module('cookie-name encoding', lifecycle);
221221

222-
test('RFC 6265 - unallowed characters in cookie-name', function () {
223-
expect(38);
224-
222+
test('RFC 6265 - character not allowed in the cookie name "("', function () {
223+
expect(2);
225224
Cookies.set('(', 'v');
226225
strictEqual(Cookies.get('('), 'v', 'should handle the opening parens character');
227226
strictEqual(document.cookie, '%28=v', 'opening parens is not allowed, need to encode');
228-
Cookies.remove('(');
227+
});
229228

229+
test('RFC 6265 - character not allowed in the cookie name ")"', function () {
230+
expect(2);
230231
Cookies.set(')', 'v');
231232
strictEqual(Cookies.get(')'), 'v', 'should handle the closing parens character');
232233
strictEqual(document.cookie, '%29=v', 'closing parens is not allowed, need to encode');
233-
Cookies.remove(')');
234+
});
234235

236+
test('RFC 6265 - character not allowed in the cookie name "<"', function () {
237+
expect(2);
235238
Cookies.set('<', 'v');
236239
strictEqual(Cookies.get('<'), 'v', 'should handle the less-than character');
237240
strictEqual(document.cookie, '%3C=v', 'less-than is not allowed, need to encode');
238-
Cookies.remove('<');
241+
});
239242

243+
test('RFC 6265 - character not allowed in the cookie name ">"', function () {
244+
expect(2);
240245
Cookies.set('>', 'v');
241246
strictEqual(Cookies.get('>'), 'v', 'should handle the greater-than character');
242247
strictEqual(document.cookie, '%3E=v', 'greater-than is not allowed, need to encode');
243-
Cookies.remove('>');
248+
});
244249

250+
test('RFC 6265 - character not allowed in the cookie name "@"', function () {
251+
expect(2);
245252
Cookies.set('@', 'v');
246253
strictEqual(Cookies.get('@'), 'v', 'should handle the at character');
247254
strictEqual(document.cookie, '%40=v', 'at is not allowed, need to encode');
248-
Cookies.remove('@');
255+
});
249256

257+
test('RFC 6265 - character not allowed in the cookie name ","', function () {
258+
expect(2);
250259
Cookies.set(',', 'v');
251260
strictEqual(Cookies.get(','), 'v', 'should handle the comma character');
252261
strictEqual(document.cookie, '%2C=v', 'comma is not allowed, need to encode');
253-
Cookies.remove(',');
262+
});
254263

264+
test('RFC 6265 - character not allowed in the cookie name ";"', function () {
265+
expect(2);
255266
Cookies.set(';', 'v');
256267
strictEqual(Cookies.get(';'), 'v', 'should handle the semicolon character');
257268
strictEqual(document.cookie, '%3B=v', 'semicolon is not allowed, need to encode');
258-
Cookies.remove(';');
269+
});
259270

271+
test('RFC 6265 - character not allowed in the cookie name ":"', function () {
272+
expect(2);
260273
Cookies.set(':', 'v');
261274
strictEqual(Cookies.get(':'), 'v', 'should handle the colon character');
262275
strictEqual(document.cookie, '%3A=v', 'colon is not allowed, need to encode');
263-
Cookies.remove(':');
276+
});
264277

278+
test('RFC 6265 - character not allowed in the cookie name "\\"', function () {
279+
expect(2);
265280
Cookies.set('\\', 'v');
266281
strictEqual(Cookies.get('\\'), 'v', 'should handle the backslash character');
267282
strictEqual(document.cookie, '%5C=v', 'backslash is not allowed, need to encode');
268-
Cookies.remove('\\');
283+
});
269284

285+
test('RFC 6265 - character not allowed in the cookie name "\""', function () {
286+
expect(2);
270287
Cookies.set('"', 'v');
271288
strictEqual(Cookies.get('"'), 'v', 'should handle the double quote character');
272289
strictEqual(document.cookie, '%22=v', 'double quote is not allowed, need to encode');
273-
Cookies.remove('"');
290+
});
274291

292+
test('RFC 6265 - character not allowed in the cookie name "/"', function () {
293+
expect(2);
275294
Cookies.set('/', 'v');
276295
strictEqual(Cookies.get('/'), 'v', 'should handle the slash character');
277296
strictEqual(document.cookie, '%2F=v', 'slash is not allowed, need to encode');
278-
Cookies.remove('/');
297+
});
279298

299+
test('RFC 6265 - character not allowed in the cookie name "["', function () {
300+
expect(2);
280301
Cookies.set('[', 'v');
281302
strictEqual(Cookies.get('['), 'v', 'should handle the opening square brackets character');
282303
strictEqual(document.cookie, '%5B=v', 'opening square brackets is not allowed, need to encode');
283-
Cookies.remove('[');
304+
});
284305

306+
test('RFC 6265 - character not allowed in the cookie name "]"', function () {
307+
expect(2);
285308
Cookies.set(']', 'v');
286309
strictEqual(Cookies.get(']'), 'v', 'should handle the closing square brackets character');
287310
strictEqual(document.cookie, '%5D=v', 'closing square brackets is not allowed, need to encode');
288-
Cookies.remove(']');
311+
});
289312

313+
test('RFC 6265 - character not allowed in the cookie name "?"', function () {
314+
expect(2);
290315
Cookies.set('?', 'v');
291316
strictEqual(Cookies.get('?'), 'v', 'should handle the question mark character');
292317
strictEqual(document.cookie, '%3F=v', 'question mark is not allowed, need to encode');
293-
Cookies.remove('?');
318+
});
294319

320+
test('RFC 6265 - character not allowed in the cookie name "="', function () {
321+
expect(2);
295322
Cookies.set('=', 'v');
296323
strictEqual(Cookies.get('='), 'v', 'should handle the equal sign character');
297324
strictEqual(document.cookie, '%3D=v', 'equal sign is not allowed, need to encode');
298-
Cookies.remove('=');
325+
});
299326

327+
test('RFC 6265 - character not allowed in the cookie name "{"', function () {
328+
expect(2);
300329
Cookies.set('{', 'v');
301330
strictEqual(Cookies.get('{'), 'v', 'should handle the opening curly brackets character');
302331
strictEqual(document.cookie, '%7B=v', 'opening curly brackets is not allowed, need to encode');
303-
Cookies.remove('{');
332+
});
304333

334+
test('RFC 6265 - character not allowed in the cookie name "}"', function () {
335+
expect(2);
305336
Cookies.set('}', 'v');
306337
strictEqual(Cookies.get('}'), 'v', 'should handle the closing curly brackets character');
307338
strictEqual(document.cookie, '%7D=v', 'closing curly brackets is not allowed, need to encode');
308-
Cookies.remove('}');
339+
});
309340

341+
test('RFC 6265 - character not allowed in the cookie name "\\t"', function () {
342+
expect(2);
310343
Cookies.set(' ', 'v');
311344
strictEqual(Cookies.get(' '), 'v', 'should handle the horizontal tab character');
312345
strictEqual(document.cookie, '%09=v', 'horizontal tab is not allowed, need to encode');
313-
Cookies.remove(' ');
346+
});
314347

348+
test('RFC 6265 - character not allowed in the cookie-name " "', function () {
349+
expect(2);
315350
Cookies.set(' ', 'v');
316351
strictEqual(Cookies.get(' '), 'v', 'should handle whitespace character');
317352
strictEqual(document.cookie, '%20=v', 'whitespace is not allowed, need to encode');
318-
Cookies.remove(' ');
319353
});
320354

321355
test('cookie-name - 2 bytes characters', function () {

0 commit comments

Comments
 (0)