summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Emanuele Stoppa <my.burning@gmail.com> 2023-12-01 10:54:54 -0500
committerGravatar GitHub <noreply@github.com> 2023-12-01 10:54:54 -0500
commit4f344b8bc77145e3e1ab54fb8b1f116a77e6f9e3 (patch)
tree2d0c3ac0051745ba7ff2b6e13274b4ff72f1d19f
parentd83991ae8b51a304405330b4af8e9cc502f9bc57 (diff)
downloadastro-4f344b8bc77145e3e1ab54fb8b1f116a77e6f9e3.tar.gz
astro-4f344b8bc77145e3e1ab54fb8b1f116a77e6f9e3.tar.zst
astro-4f344b8bc77145e3e1ab54fb8b1f116a77e6f9e3.zip
chore: add test case (#9261)
* chore: add test case * fix: replace old endpoint way * Update packages/integrations/sitemap/test/fixtures/static/src/pages/endpoint.json.ts Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> --------- Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
-rw-r--r--packages/astro/test/i18n-routing.test.js11
-rw-r--r--packages/integrations/sitemap/test/fixtures/static/src/pages/endpoint.json.ts10
2 files changed, 14 insertions, 7 deletions
diff --git a/packages/astro/test/i18n-routing.test.js b/packages/astro/test/i18n-routing.test.js
index b9fca7731..f074cbb24 100644
--- a/packages/astro/test/i18n-routing.test.js
+++ b/packages/astro/test/i18n-routing.test.js
@@ -750,12 +750,18 @@ describe('[SSG] i18n routing', () => {
let $ = cheerio.load(html);
expect(html).to.include('http-equiv="refresh');
expect(html).to.include('url=/new-site/start');
+ html = await fixture.readFile('/spanish/index.html');
+ expect(html).to.include('http-equiv="refresh');
+ expect(html).to.include('url=/new-site');
});
it('should redirect to the english locale, which is the first fallback', async () => {
- const html = await fixture.readFile('/it/start/index.html');
+ let html = await fixture.readFile('/it/start/index.html');
expect(html).to.include('http-equiv="refresh');
expect(html).to.include('url=/new-site/start');
+ html = await fixture.readFile('/it/index.html');
+ expect(html).to.include('http-equiv="refresh');
+ expect(html).to.include('url=/new-site');
});
it("should render a 404 because the route `fr` isn't included in the list of locales of the configuration", async () => {
@@ -803,6 +809,9 @@ describe('[SSG] i18n routing', () => {
let html = await fixture.readFile('/it/start/index.html');
expect(html).to.include('http-equiv="refresh');
expect(html).to.include('url=/new-site/en/start');
+ html = await fixture.readFile('/it/index.html');
+ expect(html).to.include('http-equiv="refresh');
+ expect(html).to.include('url=/new-site/en');
});
});
diff --git a/packages/integrations/sitemap/test/fixtures/static/src/pages/endpoint.json.ts b/packages/integrations/sitemap/test/fixtures/static/src/pages/endpoint.json.ts
index 4b848f339..2e088376f 100644
--- a/packages/integrations/sitemap/test/fixtures/static/src/pages/endpoint.json.ts
+++ b/packages/integrations/sitemap/test/fixtures/static/src/pages/endpoint.json.ts
@@ -1,8 +1,6 @@
export async function GET({}) {
- return {
- body: JSON.stringify({
- name: 'Astro',
- url: 'https://astro.build/',
- }),
- };
+ return Response.json({
+ name: 'Astro',
+ url: 'https://astro.build/',
+ });
}