0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-10 23:01:26 -05:00

feat: rerouting in ssg

This commit is contained in:
Emanuele Stoppa 2024-04-22 11:14:06 +01:00
parent 8e32ed8eef
commit 1d4f902e29

View file

@ -95,6 +95,70 @@ describe('Build reroute', () => {
assert.equal($('h1').text(), 'Index');
});
it('the render the index page when navigating spread route /spread/[...spread] ', async () => {
const html = await fixture.readFile('/spread/hello/index.html');
const html = await fixture.fetch('/blog/salut').then((res) => res.text());
const $ = cheerioLoad(html);
assert.equal($('h1').text(), 'Index');
});
it('the render the index page when navigating dynamic route /dynamic/[id] ', async () => {
const html = await fixture.fetch('/dynamic/hello').then((res) => res.text());
const $ = cheerioLoad(html);
assert.equal($('h1').text(), 'Index');
});
it('the render the index page when navigating spread route /spread/[...spread] ', async () => {
const html = await fixture.fetch('/spread/hello').then((res) => res.text());
const $ = cheerioLoad(html);
assert.equal($('h1').text(), 'Index');
});
});
describe.only('Build reroute', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
let devServer;
before(async () => {
fixture = await loadFixture({
root: './fixtures/reroute/',
});
await fixture.build();
});
it('the render the index page when navigating /reroute ', async () => {
const html = await fixture.readFile('/reroute/index.html');
const $ = cheerioLoad(html);
assert.equal($('h1').text(), 'Index');
});
it('the render the index page when navigating /blog/hello ', async () => {
const html = await fixture.readFile('/blog/hello/index.html');
const $ = cheerioLoad(html);
assert.equal($('h1').text(), 'Index');
});
it('the render the index page when navigating /blog/salut ', async () => {
const html = await fixture.readFile('/blog/salut/index.html');
const $ = cheerioLoad(html);
assert.equal($('h1').text(), 'Index');
});
it('the render the index page when navigating dynamic route /dynamic/[id] ', async () => {
const html = await fixture.readFile('/dynamic/hello/index.html');
const $ = cheerioLoad(html);
assert.equal($('h1').text(), 'Index');
});
it('the render the index page when navigating spread route /spread/[...spread] ', async () => {
const html = await fixture.readFile('/spread/hello/index.html');
const $ = cheerioLoad(html);