Skip to content

Commit

Permalink
Sitemap e2e test (chaynHQ#1116)
Browse files Browse the repository at this point in the history
* Fix urls

* Create sitemap e2e tests

* Simplify tests cases after review feedback

* Remove about our courses url after review feedback
  • Loading branch information
boodland authored Sep 20, 2024
1 parent 3f4d8fd commit 7388d98
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
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);
});
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>
</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>
</url>
`;
})
Expand Down

0 comments on commit 7388d98

Please sign in to comment.