astro/packages/integrations/vercel/test/edge-middleware.test.js
Emanuele Stoppa 9e5fafa2b2
feat: vercel edge middleware support (#7532)
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-07-05 16:45:58 +01:00

30 lines
822 B
JavaScript

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();
});
});