Homestays 301 fix

This commit is contained in:
2026-05-04 20:36:10 +12:00
parent fa1bc1a615
commit d115a8db7c
2 changed files with 11 additions and 0 deletions
+4
View File
@@ -12,6 +12,10 @@ export async function load({ params }) {
throw redirect(301, '/contact-us');
}
if (params.slug === 'home-stays') {
throw redirect(301, '/');
}
const slug = params.slug as StaticPageSlug;
const generalEnquiryEnabled = isGeneralEnquiryEnabled();
const sourcePage = staticPages[slug];
@@ -32,6 +32,13 @@ describe('static slug page server load', () => {
});
});
it('redirects the legacy home-stays slug to the homepage', async () => {
await expect(load({ params: { slug: 'home-stays' } } as never)).rejects.toMatchObject({
status: 301,
location: '/'
});
});
it('throws a 404 for unknown slugs', async () => {
await expect(load({ params: { slug: 'missing-page' } } as never)).rejects.toMatchObject({
status: 404