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

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

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

	it('Path is prepended by base', async () => {
		const redir = await fs.readFile(new URL('./dist/_redirects', root), 'utf-8');
		const baseRouteIndex = redir.indexOf('/test/          /.netlify/functions/entry    200');
		const imageEndpoint = redir.indexOf('/test/_image    /.netlify/functions/entry    200');

		expect(baseRouteIndex).to.not.be.equal(-1);
		expect(imageEndpoint).to.not.be.equal(-1);
	});
});