mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 09:35:56 -05:00
Fix capitalization: cookie library we use requires sameSite in opts object to have a lowercase s.
This commit is contained in:
parent
10a4e92d21
commit
34c8652ffb
2 changed files with 6 additions and 6 deletions
|
@ -79,7 +79,7 @@ const Jar = {
|
|||
opts = opts || {};
|
||||
defaults(opts, {
|
||||
expires: new Date(new Date().setYear(new Date().getFullYear() + 1)),
|
||||
SameSite: 'Strict'
|
||||
sameSite: 'Strict' // cookie library requires this capitialization of sameSite
|
||||
});
|
||||
opts.path = '/';
|
||||
const obj = cookie.serialize(name, value, opts);
|
||||
|
|
|
@ -10,7 +10,7 @@ describe('unit test lib/jar.js', () => {
|
|||
expect(cookie.serialize).toHaveBeenCalledWith('name', 'value',
|
||||
expect.objectContaining({
|
||||
path: '/',
|
||||
SameSite: 'Strict',
|
||||
sameSite: 'Strict',
|
||||
expires: expect.anything() // not specifically matching the date because it is hard to mock
|
||||
}));
|
||||
});
|
||||
|
@ -21,7 +21,7 @@ describe('unit test lib/jar.js', () => {
|
|||
expect.objectContaining({
|
||||
option: 'one',
|
||||
path: '/',
|
||||
SameSite: 'Strict',
|
||||
sameSite: 'Strict',
|
||||
expires: expect.anything() // not specifically matching the date because it is hard to mock
|
||||
}));
|
||||
});
|
||||
|
@ -38,16 +38,16 @@ describe('unit test lib/jar.js', () => {
|
|||
expires: 'someday'
|
||||
}));
|
||||
});
|
||||
test('SameSite opts overrides default', () => {
|
||||
test('sameSite opts overrides default', () => {
|
||||
jar.set('a', 'b', {
|
||||
option: 'one',
|
||||
SameSite: 'override'
|
||||
sameSite: 'override'
|
||||
});
|
||||
expect(cookie.serialize).toHaveBeenCalled();
|
||||
expect(cookie.serialize).toHaveBeenCalledWith('a', 'b',
|
||||
expect.objectContaining({
|
||||
option: 'one',
|
||||
SameSite: 'override'
|
||||
sameSite: 'override'
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue