Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
lilnasy committed Jan 8, 2024
1 parent 44f4ddf commit 8054297
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'astro/config';
import vercel from '@astrojs/vercel/serverless';

export default defineConfig({
output: 'server',
adapter: vercel()
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@test/astro-vercel-prerendered-error-pages",
"version": "0.0.0",
"private": true,
"dependencies": {
"@astrojs/vercel": "workspace:*",
"astro": "workspace:*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
export const prerender = true
---
<h1>404</h1>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<head>
<title>One</title>
</head>
<body>
<h1>One</h1>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<head>
<title>Two</title>
</head>
<body>
<h1>Two</h1>
</body>
</html>
23 changes: 23 additions & 0 deletions packages/integrations/vercel/test/prerendered-error-pages.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { loadFixture } from './test-utils.js';
import { expect } from 'chai';

describe('prerendered error pages routing', () => {
/** @type {import('./test-utils.js').Fixture} */
let fixture;

before(async () => {
fixture = await loadFixture({
root: './fixtures/prerendered-error-pages/',
});
await fixture.build();
});

it('falls back to 404.html', async () => {
const deploymentConfig = JSON.parse(await fixture.readFile('../.vercel/output/config.json'));
expect(deploymentConfig.routes.at(-1)).to.deep.include({
src: '/.*',
dest: '/404.html',
status: 404,
});
});
});
2 changes: 1 addition & 1 deletion packages/integrations/vercel/test/static.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { loadFixture } from './test-utils.js';
import { expect } from 'chai';

describe('maxDuration', () => {
describe('static routing', () => {
/** @type {import('./test-utils.js').Fixture} */
let fixture;

Expand Down
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8054297

Please sign in to comment.