fix(redirects): update app paths and other misc. (#36635)
This commit is contained in:
parent
9f40714d0a
commit
985daf5e5a
@ -3,8 +3,22 @@
|
|||||||
exports[`createRedirects matches the snapshot 1`] = `
|
exports[`createRedirects matches the snapshot 1`] = `
|
||||||
"#api redirect
|
"#api redirect
|
||||||
|
|
||||||
|
# client-route proxy
|
||||||
/internal/* https://api.example.com/internal/:splat 200
|
/internal/* https://api.example.com/internal/:splat 200
|
||||||
|
|
||||||
|
# applications
|
||||||
|
/news/* https://news.example.com/:splat 200
|
||||||
|
/forum/* https://forum.example.com/:splat 200
|
||||||
|
|
||||||
|
# pages
|
||||||
|
/about https://news.example.com/about
|
||||||
|
/terms-of-service https://news.example.com/terms-of-service
|
||||||
|
/terms https://news.example.com/terms-of-service
|
||||||
|
/academic-honesty https://news.example.com/academic-honesty
|
||||||
|
/code-of-conduct https://news.example.com/code-of-conduct
|
||||||
|
/privacy-policy https://news.example.com/privacy-policy
|
||||||
|
/privacy https://news.example.com/privacy-policy
|
||||||
|
|
||||||
# auth redirects
|
# auth redirects
|
||||||
/signin https://api.example.com/signin 200
|
/signin https://api.example.com/signin 200
|
||||||
/signup https://api.example.com/signin 200
|
/signup https://api.example.com/signin 200
|
||||||
@ -30,19 +44,17 @@ exports[`createRedirects matches the snapshot 1`] = `
|
|||||||
/chat https://gitter.im/FreeCodeCamp/FreeCodeCamp 301
|
/chat https://gitter.im/FreeCodeCamp/FreeCodeCamp 301
|
||||||
/twitch https://twitch.tv/freecodecamp 301
|
/twitch https://twitch.tv/freecodecamp 301
|
||||||
/nonprofits-form / 301
|
/nonprofits-form / 301
|
||||||
|
/nonprofits / 301
|
||||||
|
/Nonprofits / 301
|
||||||
/pmi-acp-agile-project-managers / 301
|
/pmi-acp-agile-project-managers / 301
|
||||||
/pmi-acp-agile-project-managers-form / 301
|
/pmi-acp-agile-project-managers-form / 301
|
||||||
/stories / 301
|
/stories / 301
|
||||||
/all-stories / 301
|
/all-stories / 301
|
||||||
/field-guide/* /forum 301
|
/field-guide/* / 301
|
||||||
/learn-to-code /learn 200
|
/learn-to-code /learn 301
|
||||||
/map /learn 200
|
/map /learn 200
|
||||||
/news https://news.example.com 200
|
/nonprofit-project-instructions / 301
|
||||||
/news/* https://news.example.com/:splat 200
|
/how-nonprofit-projects-work / 301
|
||||||
/forum/* https://forum.example.com/:splat 200
|
|
||||||
/privacy https://forum.example.com/t/free-code-camp-privacy-policy/19545 301
|
|
||||||
/nonprofit-project-instructions https://forum.example.com/t/how-free-code-camps-nonprofits-projects-work/19547 301
|
|
||||||
/how-nonprofit-projects-work https://www.freecodecamp.org/news/open-source-for-good-1a0ea9f32d5a 301
|
|
||||||
|
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
@ -24,8 +24,22 @@ exports.createRedirects = function createRedirects(locations) {
|
|||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
const template = `#api redirect
|
const template = `#api redirect
|
||||||
|
|
||||||
|
# client-route proxy
|
||||||
/internal/* #{{API}}/internal/:splat 200
|
/internal/* #{{API}}/internal/:splat 200
|
||||||
|
|
||||||
|
# applications
|
||||||
|
/news/* #{{NEWS}}/:splat 200
|
||||||
|
/forum/* #{{FORUM}}/:splat 200
|
||||||
|
|
||||||
|
# pages
|
||||||
|
/about #{{NEWS}}/about
|
||||||
|
/terms-of-service #{{NEWS}}/terms-of-service
|
||||||
|
/terms #{{NEWS}}/terms-of-service
|
||||||
|
/academic-honesty #{{NEWS}}/academic-honesty
|
||||||
|
/code-of-conduct #{{NEWS}}/code-of-conduct
|
||||||
|
/privacy-policy #{{NEWS}}/privacy-policy
|
||||||
|
/privacy #{{NEWS}}/privacy-policy
|
||||||
|
|
||||||
# auth redirects
|
# auth redirects
|
||||||
/signin #{{API}}/signin 200
|
/signin #{{API}}/signin 200
|
||||||
/signup #{{API}}/signin 200
|
/signup #{{API}}/signin 200
|
||||||
@ -51,19 +65,17 @@ const template = `#api redirect
|
|||||||
/chat https://gitter.im/FreeCodeCamp/FreeCodeCamp 301
|
/chat https://gitter.im/FreeCodeCamp/FreeCodeCamp 301
|
||||||
/twitch https://twitch.tv/freecodecamp 301
|
/twitch https://twitch.tv/freecodecamp 301
|
||||||
/nonprofits-form / 301
|
/nonprofits-form / 301
|
||||||
|
/nonprofits / 301
|
||||||
|
/Nonprofits / 301
|
||||||
/pmi-acp-agile-project-managers / 301
|
/pmi-acp-agile-project-managers / 301
|
||||||
/pmi-acp-agile-project-managers-form / 301
|
/pmi-acp-agile-project-managers-form / 301
|
||||||
/stories / 301
|
/stories / 301
|
||||||
/all-stories / 301
|
/all-stories / 301
|
||||||
/field-guide/* /forum 301
|
/field-guide/* / 301
|
||||||
/learn-to-code /learn 200
|
/learn-to-code /learn 301
|
||||||
/map /learn 200
|
/map /learn 200
|
||||||
/news #{{NEWS}} 200
|
/nonprofit-project-instructions / 301
|
||||||
/news/* #{{NEWS}}/:splat 200
|
/how-nonprofit-projects-work / 301
|
||||||
/forum/* #{{FORUM}}/:splat 200
|
|
||||||
/privacy #{{FORUM}}/t/free-code-camp-privacy-policy/19545 301
|
|
||||||
/nonprofit-project-instructions #{{FORUM}}/t/how-free-code-camps-nonprofits-projects-work/19547 301
|
|
||||||
/how-nonprofit-projects-work https://www.freecodecamp.org/news/open-source-for-good-1a0ea9f32d5a 301
|
|
||||||
|
|
||||||
`;
|
`;
|
||||||
/* eslint-enable max-len */
|
/* eslint-enable max-len */
|
||||||
|
@ -18,7 +18,7 @@ describe('createRedirects', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('replaces instances of `#{{...}}` with the locations provided', () => {
|
it('replaces instances of `#{{...}}` with the locations provided', () => {
|
||||||
expect.assertions(6);
|
expect.assertions(5);
|
||||||
|
|
||||||
const apiPlaceholderRE = /#\{\{API\}\}/;
|
const apiPlaceholderRE = /#\{\{API\}\}/;
|
||||||
const newsPlaceholderRE = /#\{\{NEWS\}\}/;
|
const newsPlaceholderRE = /#\{\{NEWS\}\}/;
|
||||||
@ -35,9 +35,6 @@ describe('createRedirects', () => {
|
|||||||
|
|
||||||
const { api, forum } = testLocations;
|
const { api, forum } = testLocations;
|
||||||
expect(redirects.includes(`${api}/internal/:splat`)).toBe(true);
|
expect(redirects.includes(`${api}/internal/:splat`)).toBe(true);
|
||||||
expect(
|
|
||||||
redirects.includes(`${forum}/t/free-code-camp-privacy-policy/19545 301`)
|
|
||||||
).toBe(true);
|
|
||||||
expect(redirects.includes(`${forum}`)).toBe(true);
|
expect(redirects.includes(`${forum}`)).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user