mirror of
https://github.com/withastro/astro.git
synced 2024-12-30 22:03:56 -05:00
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>
This commit is contained in:
parent
d83991ae8b
commit
4f344b8bc7
2 changed files with 14 additions and 7 deletions
|
@ -750,12 +750,18 @@ describe('[SSG] i18n routing', () => {
|
||||||
let $ = cheerio.load(html);
|
let $ = cheerio.load(html);
|
||||||
expect(html).to.include('http-equiv="refresh');
|
expect(html).to.include('http-equiv="refresh');
|
||||||
expect(html).to.include('url=/new-site/start');
|
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 () => {
|
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('http-equiv="refresh');
|
||||||
expect(html).to.include('url=/new-site/start');
|
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 () => {
|
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');
|
let html = await fixture.readFile('/it/start/index.html');
|
||||||
expect(html).to.include('http-equiv="refresh');
|
expect(html).to.include('http-equiv="refresh');
|
||||||
expect(html).to.include('url=/new-site/en/start');
|
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');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
export async function GET({}) {
|
export async function GET({}) {
|
||||||
return {
|
return Response.json({
|
||||||
body: JSON.stringify({
|
name: 'Astro',
|
||||||
name: 'Astro',
|
url: 'https://astro.build/',
|
||||||
url: 'https://astro.build/',
|
});
|
||||||
}),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue