summaryrefslogtreecommitdiff
path: root/packages/integrations/vercel/test/edge-middleware.test.js
blob: dd4b25b677bcd6f002cebd4d6a5fe4d6757431dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { loadFixture } from './test-utils.js';
import { expect, use } from 'chai';
import chaiJestSnapshot from 'chai-jest-snapshot';

use(chaiJestSnapshot);

describe('Serverless prerender', () => {
	/** @type {import('./test-utils').Fixture} */
	let fixture;

	beforeEach(function () {
		chaiJestSnapshot.configureUsingMochaContext(this);
	});

	before(async () => {
		chaiJestSnapshot.resetSnapshotRegistry();
		fixture = await loadFixture({
			root: './fixtures/middleware/',
		});
	});

	it('build successfully the middleware edge file', async () => {
		await fixture.build();
		const contents = await fixture.readFile(
			// this is abysmal...
			'../.vercel/output/functions/render.func/packages/integrations/vercel/test/fixtures/middleware/dist/middleware.mjs'
		);
		expect(contents).to.matchSnapshot();
	});
});