-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
78 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/integrations/netlify/test/functions/fixtures/prerender/src/pages/404.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<html> | ||
<head> | ||
<title>Testing</title> | ||
</head> | ||
<body> | ||
<h1>testing</h1> | ||
</body> | ||
</html> |
8 changes: 8 additions & 0 deletions
8
packages/integrations/netlify/test/functions/fixtures/prerender/src/pages/index.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<html> | ||
<head> | ||
<title>Testing</title> | ||
</head> | ||
<body> | ||
<h1>testing</h1> | ||
</body> | ||
</html> |
11 changes: 11 additions & 0 deletions
11
packages/integrations/netlify/test/functions/fixtures/prerender/src/pages/one.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
export const prerender = true; | ||
--- | ||
<html> | ||
<head> | ||
<title>Testing</title> | ||
</head> | ||
<body> | ||
<h1>testing</h1> | ||
</body> | ||
</html> |
30 changes: 30 additions & 0 deletions
30
packages/integrations/netlify/test/functions/prerender.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { expect } from 'chai'; | ||
import netlifyAdapter from '../../dist/index.js'; | ||
import { loadFixture, testIntegration } from './test-utils.js'; | ||
|
||
describe('Mixed Prerendering with SSR', () => { | ||
/** @type {import('./test-utils').Fixture} */ | ||
let fixture; | ||
|
||
before(async () => { | ||
fixture = await loadFixture({ | ||
root: new URL('./fixtures/prerender/', import.meta.url).toString(), | ||
output: 'server', | ||
adapter: netlifyAdapter({ | ||
dist: new URL('./fixtures/prerender/dist/', import.meta.url), | ||
}), | ||
site: `http://example.com`, | ||
integrations: [testIntegration()], | ||
}); | ||
await fixture.build(); | ||
}); | ||
it('Wildcard 404 is sorted last', async () => { | ||
const redir = await fixture.readFile('/_redirects'); | ||
const baseRouteIndex = redir.indexOf('/ /.netlify/functions/entry 200'); | ||
const oneRouteIndex = redir.indexOf('/one /one/index.html 200'); | ||
const fourOhFourWildCardIndex = redir.indexOf('/* /.netlify/functions/entry 404'); | ||
|
||
expect(fourOhFourWildCardIndex).to.be.greaterThan(baseRouteIndex); | ||
expect(fourOhFourWildCardIndex).to.be.greaterThan(oneRouteIndex); | ||
}); | ||
}); |