mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 23:57:55 -05:00
Merge pull request #4246 from LLK/develop
Update release branch to include develop
This commit is contained in:
commit
0dadc58059
5 changed files with 69 additions and 75 deletions
12
package-lock.json
generated
12
package-lock.json
generated
|
@ -15725,15 +15725,15 @@
|
|||
}
|
||||
},
|
||||
"scratch-gui": {
|
||||
"version": "0.1.0-prerelease.20200722032238",
|
||||
"resolved": "https://registry.npmjs.org/scratch-gui/-/scratch-gui-0.1.0-prerelease.20200722032238.tgz",
|
||||
"integrity": "sha512-s+wcSvbnKwdYSZpa+VY/ki55r6ij+jZ2YmZWT8eqiDJw5VO/QWkmf11IGbEdvTforJgwTBjB+dQm9bWvWH7iYg==",
|
||||
"version": "0.1.0-prerelease.20200729032223",
|
||||
"resolved": "https://registry.npmjs.org/scratch-gui/-/scratch-gui-0.1.0-prerelease.20200729032223.tgz",
|
||||
"integrity": "sha512-enULTkLhNi69oiCEEXteMqxSw12lbKSfcEPifCoDwlFkXCms89M+wyCAUTl/Shvb5j6iYUo6lS0Iq/wcBzJSFQ==",
|
||||
"dev": true
|
||||
},
|
||||
"scratch-l10n": {
|
||||
"version": "3.10.20200722030735",
|
||||
"resolved": "https://registry.npmjs.org/scratch-l10n/-/scratch-l10n-3.10.20200722030735.tgz",
|
||||
"integrity": "sha512-cjGHaJ5pT7QKxnYg/ItsVL2YU9M1X+Xj2um+qoIkX7nMCI6JWfZ6jXNE4zeSzwD7vGOOF//9ZIMYhxXhlCdljQ==",
|
||||
"version": "3.10.20200729030742",
|
||||
"resolved": "https://registry.npmjs.org/scratch-l10n/-/scratch-l10n-3.10.20200729030742.tgz",
|
||||
"integrity": "sha512-1dwvCHNMN1ycMSOALQNaGgQJvAn7lbyPoM7Atbc+PJrp8dq7MD6GdoZmrA+bVBzncsLuWcBPDL+txCVGyIKPQQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/cli": "^7.1.2",
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
"redux-mock-store": "^1.2.3",
|
||||
"redux-thunk": "2.0.1",
|
||||
"sass-loader": "6.0.6",
|
||||
"scratch-gui": "0.1.0-prerelease.20200722032238",
|
||||
"scratch-gui": "0.1.0-prerelease.20200729032223",
|
||||
"scratch-l10n": "latest",
|
||||
"selenium-webdriver": "3.6.0",
|
||||
"slick-carousel": "1.6.0",
|
||||
|
|
|
@ -78,7 +78,8 @@ const Jar = {
|
|||
set: (name, value, opts) => {
|
||||
opts = 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' // cookie library requires this capitialization of sameSite
|
||||
});
|
||||
opts.path = '/';
|
||||
const obj = cookie.serialize(name, value, opts);
|
||||
|
|
|
@ -140,8 +140,6 @@ tap.test('clickDiscussionForumsLink', options, t => {
|
|||
});
|
||||
});
|
||||
|
||||
// SCRATCH WIKI test has been removed.
|
||||
|
||||
// STATISTICS
|
||||
tap.test('clickStatisticsLink', options, t => {
|
||||
const linkText = 'Statistics';
|
||||
|
@ -194,28 +192,6 @@ tap.test('clickContactUsLink', options, t => {
|
|||
});
|
||||
});
|
||||
|
||||
// skip this test since it points to an external site
|
||||
// SCRATCH STORE
|
||||
tap.test('clickScratchStoreLink', {skip: true}, t => {
|
||||
const linkText = 'Scratch Store';
|
||||
const expectedUrl = 'https://scratch-foundation.myshopify.com/';
|
||||
clickFooterLinks(linkText).then(url => {
|
||||
t.equal(url, expectedUrl);
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
// skip this test since it points to an external site
|
||||
// DONATE
|
||||
tap.test('clickDonateLink', {skip: true}, t => {
|
||||
const linkText = 'Donate';
|
||||
const expectedUrl = 'https://secure.donationpay.org/scratchfoundation/';
|
||||
clickFooterLinks(linkText).then(url => {
|
||||
t.equal(url, expectedUrl);
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
// ==== LEGAL column ====
|
||||
|
||||
// TERMS OF USE
|
||||
|
@ -249,40 +225,6 @@ tap.test('clickDMCALink', options, t => {
|
|||
});
|
||||
|
||||
// ==== SCRATCH FAMILY column ====
|
||||
|
||||
// skip this test since it points to an external site
|
||||
// SCRATCH ED (SCRATCHED)
|
||||
tap.test('clickScratchEdLink', {skip: true}, t => {
|
||||
const linkText = 'ScratchEd';
|
||||
const expectedUrl = 'http://scratched.gse.harvard.edu/';
|
||||
clickFooterLinks(linkText).then(url => {
|
||||
t.equal(url, expectedUrl);
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
// skip this test since it points to an external site
|
||||
// SCRATCH JR (SCRATCHJR)
|
||||
tap.test('clickScratchJrLink', {skip: true}, t => {
|
||||
const linkText = 'ScratchJr';
|
||||
const expectedUrl = 'https://www.scratchjr.org/';
|
||||
clickFooterLinks(linkText).then(url => {
|
||||
t.equal(url, expectedUrl);
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
// skip this test since it points to an external site
|
||||
// SCRATCH DAY
|
||||
tap.test('clickScratchDayLink', {skip: true}, t => {
|
||||
const linkText = 'Scratch Day';
|
||||
const expectedUrl = 'https://day.scratch.mit.edu/';
|
||||
clickFooterLinks(linkText).then(url => {
|
||||
t.equal(url, expectedUrl);
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
// SCRATCH CONFERENCE
|
||||
tap.test('clickScratchConferenceLink', options, t => {
|
||||
const linkText = 'Scratch Conference';
|
||||
|
@ -292,14 +234,12 @@ tap.test('clickScratchConferenceLink', options, t => {
|
|||
t.end();
|
||||
});
|
||||
});
|
||||
// The following links in are skipped because they are not on scratch.mit.edu
|
||||
|
||||
// skip this test since it points to an external site
|
||||
// SCRATCH STORE
|
||||
// DONATE
|
||||
// SCRATCH WIKI
|
||||
// SCRATCH ED (SCRATCHED)
|
||||
// SCRATCH JR (SCRATCHJR)
|
||||
// SCRATCH DAY
|
||||
// SCRATCH FOUNDATION
|
||||
tap.test('clickScratchFoundationLink', {skip: true}, t => {
|
||||
const linkText = 'Scratch Foundation';
|
||||
const expectedUrl = 'https://www.scratchfoundation.org/';
|
||||
clickFooterLinks(linkText).then(url => {
|
||||
t.equal(url, expectedUrl);
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
|
53
test/unit/lib/jar.test.js
Normal file
53
test/unit/lib/jar.test.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
const jar = require('../../../src/lib/jar');
|
||||
const cookie = require('cookie');
|
||||
|
||||
jest.mock('cookie', () => ({serialize: jest.fn()}));
|
||||
describe('unit test lib/jar.js', () => {
|
||||
|
||||
test('simple set test with no opts', () => {
|
||||
jar.set('name', 'value');
|
||||
expect(cookie.serialize).toHaveBeenCalled();
|
||||
expect(cookie.serialize).toHaveBeenCalledWith('name', 'value',
|
||||
expect.objectContaining({
|
||||
path: '/',
|
||||
sameSite: 'Strict',
|
||||
expires: expect.anything() // not specifically matching the date because it is hard to mock
|
||||
}));
|
||||
});
|
||||
test('test with opts', () => {
|
||||
jar.set('a', 'b', {option: 'one'});
|
||||
expect(cookie.serialize).toHaveBeenCalled();
|
||||
expect(cookie.serialize).toHaveBeenCalledWith('a', 'b',
|
||||
expect.objectContaining({
|
||||
option: 'one',
|
||||
path: '/',
|
||||
sameSite: 'Strict',
|
||||
expires: expect.anything() // not specifically matching the date because it is hard to mock
|
||||
}));
|
||||
});
|
||||
test('expires opts overrides default', () => {
|
||||
jar.set('a', 'b', {
|
||||
option: 'one',
|
||||
expires: 'someday'
|
||||
});
|
||||
expect(cookie.serialize).toHaveBeenCalled();
|
||||
expect(cookie.serialize).toHaveBeenCalledWith('a', 'b',
|
||||
expect.objectContaining({
|
||||
option: 'one',
|
||||
path: '/',
|
||||
expires: 'someday'
|
||||
}));
|
||||
});
|
||||
test('sameSite opts overrides default', () => {
|
||||
jar.set('a', 'b', {
|
||||
option: 'one',
|
||||
sameSite: 'override'
|
||||
});
|
||||
expect(cookie.serialize).toHaveBeenCalled();
|
||||
expect(cookie.serialize).toHaveBeenCalledWith('a', 'b',
|
||||
expect.objectContaining({
|
||||
option: 'one',
|
||||
sameSite: 'override'
|
||||
}));
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue