Skip to content
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

Sitemap e2e test #1116

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cypress/integration/tests/sitemap.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
describe('Sitemap should have', () => {
const SITEMAP_URL = '/sitemap.xml';
const BLOOM_URL = 'https://bloom.chayn.co';
before(() => {
cy.cleanUpTestState();
});

it('bloom url', () => {
cy.request(SITEMAP_URL).its('body').should('include', BLOOM_URL);
boodland marked this conversation as resolved.
Show resolved Hide resolved
});
it('meet the team url', () => {
cy.request(SITEMAP_URL)
.its('body')
.should('include', BLOOM_URL + '/meet-the-team');
});
});
10 changes: 4 additions & 6 deletions pages/sitemap.xml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ async function generateSiteMap({ locales }: any) {
<loc>https://bloom.chayn.co</loc>
</url>
<url>
<loc>https://bloom.chayn.co/therapy/about-our-courses</loc>
</url>
<url>
<loc>https://bloom.chayn.co/therapy/meet-the-team</loc>
<loc>https://bloom.chayn.co/meet-the-team</loc>
boodland marked this conversation as resolved.
Show resolved Hide resolved
</url>
<url>
<loc>https://bloom.chayn.co/therapy/book-session</loc>
Expand All @@ -22,10 +19,11 @@ async function generateSiteMap({ locales }: any) {
<loc>https://bloom.chayn.co/therapy/confirmed-session</loc>
</url>
${courses
.map((course: any) => {
.map((course: { locale: string; params: { slug: string; sessionSlug: string } }) => {
const locale = course.locale !== 'en' ? `/${course.locale}` : '';
return `
<url>
<loc>${`https://bloom.chayn.co/courses/${course.params.slug}/${course.params.sessionSlug}`}</loc>
<loc>${`https://bloom.chayn.co${locale}/courses/${course.params.slug}/${course.params.sessionSlug}`}</loc>
boodland marked this conversation as resolved.
Show resolved Hide resolved
</url>
`;
})
Expand Down
Loading