summaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/test/functions/404.test.js
blob: 7a5103e377db8c6658e7b3b7a83036d8589c1429 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { fileURLToPath } from 'url';
import { expect } from 'chai';
import fs from 'fs/promises';
import { cli } from './test-utils.js';

const root = new URL('./fixtures/404/', import.meta.url).toString();

describe('404 page', () => {
	before(async () => {
		await cli('build', '--root', fileURLToPath(root));
	});

	it('404 route is included in the redirect file', async () => {
		const redir = await fs.readFile(new URL('./dist/_redirects', root), 'utf-8');
		const expr = new RegExp('/*    /.netlify/functions/entry    404');
		expect(redir).to.match(expr);
	});
});