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:
parent
8e32ed8eef
commit
1d4f902e29
1 changed files with 64 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue