astro/packages/integrations/netlify/test/functions/404.test.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
808 B
JavaScript
Raw Permalink Normal View History

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');
2022-08-11 23:29:45 +00:00
const expr = new RegExp('/* /.netlify/functions/entry 404');
expect(redir).to.match(expr);
});
});