[ci] format

This commit is contained in:
tony-sull 2022-05-20 19:59:55 +00:00 committed by github-actions[bot]
parent 6373508458
commit 1f148dbcfd
2 changed files with 43 additions and 43 deletions

View file

@ -163,7 +163,7 @@ export async function collectPagesData(
});
finalPaths.map((staticPath) => builtPaths.add(removeTrailingForwardSlash(staticPath)));
allPages[route.component] = {
component: route.component,
route,

View file

@ -8,61 +8,61 @@ let fixture;
const routes = [
{
url: '/',
h1: 'index.astro'
h1: 'index.astro',
},
{
url: '/posts/post-1',
h1: 'posts/[pid].astro',
p: 'post-1'
p: 'post-1',
},
{
url: '/posts/post-2',
h1: 'posts/[pid].astro',
p: 'post-2'
p: 'post-2',
},
{
url: '/posts/1/2',
h1: 'posts/[...slug].astro',
p: '1/2'
p: '1/2',
},
{
{
url: '/de',
h1: 'de/index.astro'
h1: 'de/index.astro',
},
{
url: '/de/',
h1: 'de/index.astro'
h1: 'de/index.astro',
},
{
url: '/de/index.html',
h1: 'de/index.astro'
h1: 'de/index.astro',
},
{
url: '/en',
h1: '[lang]/index.astro',
p: 'en'
p: 'en',
},
{
url: '/en/',
h1: '[lang]/index.astro',
p: 'en'
p: 'en',
},
{
url: '/en/index.html',
h1: '[lang]/index.astro',
p: 'en'
p: 'en',
},
{
url: '/de/1/2',
h1: '[lang]/[...catchall].astro',
p: 'de | 1/2'
p: 'de | 1/2',
},
{
url: '/en/1/2',
h1: '[lang]/[...catchall].astro',
p: 'en | 1/2'
}
]
p: 'en | 1/2',
},
];
describe('Routing priority', () => {
before(async () => {
@ -119,7 +119,7 @@ describe('Routing priority', () => {
const $ = cheerioLoad(html);
expect($('h1').text()).to.equal('[lang]/[...catchall].astro');
expect($('p').text()).to.equal('de | 1/2')
expect($('p').text()).to.equal('de | 1/2');
});
it('matches /en/1/2 to [lang]/[...catchall].astro', async () => {
@ -127,7 +127,7 @@ describe('Routing priority', () => {
const $ = cheerioLoad(html);
expect($('h1').text()).to.equal('[lang]/[...catchall].astro');
expect($('p').text()).to.equal('en | 1/2')
expect($('p').text()).to.equal('en | 1/2');
});
});
@ -144,77 +144,77 @@ describe('Routing priority', () => {
it('matches / to index.astro', async () => {
const html = await fixture.fetch('/').then((res) => res.text());
const $ = cheerioLoad(html);
const $ = cheerioLoad(html);
expect($('h1').text()).to.equal('index.astro');
expect($('h1').text()).to.equal('index.astro');
});
it('matches /posts/post-1 to /posts/[pid].astro', async () => {
const html = await fixture.fetch('/posts/post-1').then((res) => res.text());
const $ = cheerioLoad(html);
const $ = cheerioLoad(html);
expect($('h1').text()).to.equal('posts/[pid].astro');
expect($('p').text()).to.equal('post-1');
expect($('h1').text()).to.equal('posts/[pid].astro');
expect($('p').text()).to.equal('post-1');
});
it('matches /posts/1/2 to /posts/[...slug].astro', async () => {
const html = await fixture.fetch('/posts/1/2').then((res) => res.text());
const $ = cheerioLoad(html);
const $ = cheerioLoad(html);
expect($('h1').text()).to.equal('posts/[...slug].astro');
expect($('p').text()).to.equal('1/2');
expect($('h1').text()).to.equal('posts/[...slug].astro');
expect($('p').text()).to.equal('1/2');
});
it('matches /de to de/index.astro', async () => {
const html = await fixture.fetch('/de').then((res) => res.text());
const $ = cheerioLoad(html);
const $ = cheerioLoad(html);
expect($('h1').text()).to.equal('de/index.astro');
expect($('h1').text()).to.equal('de/index.astro');
});
it('matches /de to de/index.astro', async () => {
const html = await fixture.fetch('/de').then((res) => res.text());
const $ = cheerioLoad(html);
const $ = cheerioLoad(html);
expect($('h1').text()).to.equal('de/index.astro');
expect($('h1').text()).to.equal('de/index.astro');
});
it('matches /de/ to de/index.astro', async () => {
const html = await fixture.fetch('/de/').then((res) => res.text());
const $ = cheerioLoad(html);
const $ = cheerioLoad(html);
expect($('h1').text()).to.equal('de/index.astro');
expect($('h1').text()).to.equal('de/index.astro');
});
it('matches /de/index.html to de/index.astro', async () => {
const html = await fixture.fetch('/de/index.html').then((res) => res.text());
const $ = cheerioLoad(html);
const $ = cheerioLoad(html);
expect($('h1').text()).to.equal('de/index.astro');
expect($('h1').text()).to.equal('de/index.astro');
});
it('matches /en to [lang]/index.astro', async () => {
const html = await fixture.fetch('/en').then((res) => res.text());
const $ = cheerioLoad(html);
const $ = cheerioLoad(html);
expect($('h1').text()).to.equal('[lang]/index.astro');
expect($('p').text()).to.equal('en');
expect($('h1').text()).to.equal('[lang]/index.astro');
expect($('p').text()).to.equal('en');
});
it('matches /en/ to [lang]/index.astro', async () => {
const html = await fixture.fetch('/en/').then((res) => res.text());
const $ = cheerioLoad(html);
const $ = cheerioLoad(html);
expect($('h1').text()).to.equal('[lang]/index.astro');
expect($('p').text()).to.equal('en');
expect($('h1').text()).to.equal('[lang]/index.astro');
expect($('p').text()).to.equal('en');
});
it('matches /en/index.html to de/index.astro', async () => {
const html = await fixture.fetch('/en/index.html').then((res) => res.text());
const $ = cheerioLoad(html);
const $ = cheerioLoad(html);
expect($('h1').text()).to.equal('[lang]/index.astro');
expect($('p').text()).to.equal('en');
expect($('h1').text()).to.equal('[lang]/index.astro');
expect($('p').text()).to.equal('en');
});
it('matches /de/1/2 to [lang]/[...catchall].astro', async () => {