astro/packages/integrations/netlify/test/functions/404.test.js
2022-08-11 23:29:45 +00:00

27 lines
808 B
JavaScript

import { expect } from 'chai';
import netlifyAdapter from '../../dist/index.js';
import { loadFixture, testIntegration } from './test-utils.js';
describe('404 page', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
before(async () => {
fixture = await loadFixture({
root: new URL('./fixtures/404/', import.meta.url).toString(),
output: 'server',
adapter: netlifyAdapter({
dist: new URL('./fixtures/404/dist/', import.meta.url),
}),
site: `http://example.com`,
integrations: [testIntegration()],
});
await fixture.build();
});
it('404 route is included in the redirect file', async () => {
const redir = await fixture.readFile('/_redirects');
const expr = new RegExp('/* /.netlify/functions/entry 404');
expect(redir).to.match(expr);
});
});