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 || {};
|
opts = opts || {};
|
||||||
defaults(opts, {
|
defaults(opts, {
|
||||||
expires: new Date(new Date().setYear(new Date().getFullYear() + 1)),
|
expires: new Date(new Date().setYear(new Date().getFullYear() + 1)),
|
||||||
SameSite: 'Strict'
|
sameSite: 'Strict' // cookie library requires this capitialization of sameSite
|
||||||
});
|
});
|
||||||
opts.path = '/';
|
opts.path = '/';
|
||||||
const obj = cookie.serialize(name, value, opts);
|
const obj = cookie.serialize(name, value, opts);
|
||||||
|
|
|
@ -10,7 +10,7 @@ describe('unit test lib/jar.js', () => {
|
||||||
expect(cookie.serialize).toHaveBeenCalledWith('name', 'value',
|
expect(cookie.serialize).toHaveBeenCalledWith('name', 'value',
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
path: '/',
|
path: '/',
|
||||||
SameSite: 'Strict',
|
sameSite: 'Strict',
|
||||||
expires: expect.anything() // not specifically matching the date because it is hard to mock
|
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({
|
expect.objectContaining({
|
||||||
option: 'one',
|
option: 'one',
|
||||||
path: '/',
|
path: '/',
|
||||||
SameSite: 'Strict',
|
sameSite: 'Strict',
|
||||||
expires: expect.anything() // not specifically matching the date because it is hard to mock
|
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'
|
expires: 'someday'
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
test('SameSite opts overrides default', () => {
|
test('sameSite opts overrides default', () => {
|
||||||
jar.set('a', 'b', {
|
jar.set('a', 'b', {
|
||||||
option: 'one',
|
option: 'one',
|
||||||
SameSite: 'override'
|
sameSite: 'override'
|
||||||
});
|
});
|
||||||
expect(cookie.serialize).toHaveBeenCalled();
|
expect(cookie.serialize).toHaveBeenCalled();
|
||||||
expect(cookie.serialize).toHaveBeenCalledWith('a', 'b',
|
expect(cookie.serialize).toHaveBeenCalledWith('a', 'b',
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
option: 'one',
|
option: 'one',
|
||||||
SameSite: 'override'
|
sameSite: 'override'
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue