Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 0dcf209

Browse files
committed
Improve cookie JS example for robust E2E testing
Checks the goja-incompatible fields to ensure we're setting them while adding and retriving cookies. We do this only for the cookie to not to conflate the example.
1 parent d30cebc commit 0dcf209

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

examples/cookies.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export default async function () {
4040
sameSite: 'Strict',
4141
domain: '127.0.0.1',
4242
path: '/',
43+
httpOnly: true,
44+
secure: true,
4345
},
4446
// this cookie expires in a day
4547
{
@@ -67,6 +69,12 @@ export default async function () {
6769
check(cookies[0], {
6870
'cookie 1 name should be testcookie': c => c.name === 'testcookie',
6971
'cookie 1 value should be 1': c => c.value === '1',
72+
'cookie 1 should be session cookie': c => c.expires === -1,
73+
'cookie 1 should have domain': c => c.domain === '127.0.0.1',
74+
'cookie 1 should have path': c => c.path === '/',
75+
'cookie 1 should have sameSite': c => c.sameSite == 'Strict',
76+
'cookie 1 should be httpOnly': c => c.httpOnly === true,
77+
'cookie 1 should be secure': c => c.secure === true,
7078
});
7179
check(cookies[1], {
7280
'cookie 2 name should be testcookie2': c => c.name === 'testcookie2',
@@ -94,7 +102,6 @@ export default async function () {
94102
url: 'https://baz.com'
95103
}
96104
]);
97-
98105
cookies = context.cookies('http://foo.com', 'https://baz.com');
99106
check(cookies.length, {
100107
'number of filtered cookies should be 2': n => n === 2,

0 commit comments

Comments
 (0)