New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(nxdev): redirects to send legacy tutorial links to new locations #12752
feat(nxdev): redirects to send legacy tutorial links to new locations #12752
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
[still want to add tests for this; @bcabanes, can you let me know at what level we'd like to add these?] |
Hey @bcabanes, as I mentioned, I'm looking to add some testing to these to ensure the redirects work as directed. I was going to opt into a set of e2e tests to assert the redirect actually works (see below), but happy to move that to some unit test if you prefer that strategy (or these would be too expensive) describe('Tutorial redirects', () => {
const redirects: {
givenUrl: string;
expectedDestination: string;
}[] = [
{
givenUrl: '/react-tutorial/01-create-application',
expectedDestination: '/react-tutorial/1-code-generation',
},
{
givenUrl: '/react-tutorial/02-add-e2e-test',
expectedDestination: '/react-tutorial/1-code-generation',
},
// ...
];
for (const redirect of redirects) {
testRedirect(redirect);
}
});
function testRedirect({
givenUrl,
expectedDestination,
}: {
givenUrl: string;
expectedDestination: string;
}) {
it(`"${givenUrl}" to ${expectedDestination}`, () => {
cy.visit(givenUrl);
cy.url().should('include', expectedDestination);
});
} |
@ZackDeRose Instead of adding 24 new E2E tests that will slow down the whole CI run, we could change these tests to unit tests making sure the redirect rules are declared and their values are correct (without hitting the website). There are multiple things here:
|
f42528b
to
686aba5
Compare
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
Links to legacy docs (e.g. https://nx.dev/react-tutorial/01-create-application) lead to a 404 page.
Expected Behavior
User navigating to any old link get redirected to step 1 of the new tutorial (https://nx.dev/react-tutorial/1-code-generation).
Related Issue(s)
Fixes #