2023-02-21 14:14:47 +00:00
|
|
|
import { expect } from 'chai';
|
2023-05-02 07:42:48 +00:00
|
|
|
import { loadFixture } from './test-utils.js';
|
2023-02-21 14:14:47 +00:00
|
|
|
|
|
|
|
describe('Serverless prerender', () => {
|
|
|
|
/** @type {import('./test-utils').Fixture} */
|
|
|
|
let fixture;
|
|
|
|
|
|
|
|
before(async () => {
|
2023-05-17 13:23:20 +00:00
|
|
|
process.env.PRERENDER = true;
|
2023-02-21 14:14:47 +00:00
|
|
|
fixture = await loadFixture({
|
|
|
|
root: './fixtures/serverless-prerender/',
|
|
|
|
});
|
2023-07-17 12:57:27 +00:00
|
|
|
await fixture.build();
|
2023-02-21 14:14:47 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('build successful', async () => {
|
2023-05-02 07:42:48 +00:00
|
|
|
expect(await fixture.readFile('../.vercel/output/static/index.html')).to.be.ok;
|
2023-02-21 14:14:47 +00:00
|
|
|
});
|
2023-07-17 12:57:27 +00:00
|
|
|
|
2023-08-16 08:21:05 +00:00
|
|
|
// TODO: The path here seems to be inconsistent?
|
|
|
|
it.skip('includeFiles work', async () => {
|
2023-07-17 12:57:27 +00:00
|
|
|
expect(
|
|
|
|
await fixture.readFile(
|
2023-08-16 08:21:05 +00:00
|
|
|
'../.vercel/output/functions/render.func/packages/integrations/vercel/test/fixtures/serverless-prerender/dist/middleware.mjs'
|
2023-07-17 12:57:27 +00:00
|
|
|
)
|
|
|
|
).to.be.ok;
|
|
|
|
});
|
2023-02-21 14:14:47 +00:00
|
|
|
});
|
2023-05-17 13:23:20 +00:00
|
|
|
|
|
|
|
describe('Serverless hybrid rendering', () => {
|
|
|
|
/** @type {import('./test-utils').Fixture} */
|
|
|
|
let fixture;
|
|
|
|
|
|
|
|
before(async () => {
|
|
|
|
process.env.PRERENDER = true;
|
|
|
|
fixture = await loadFixture({
|
|
|
|
root: './fixtures/serverless-prerender/',
|
2023-05-17 13:26:03 +00:00
|
|
|
output: 'hybrid',
|
2023-05-17 13:23:20 +00:00
|
|
|
});
|
2023-07-17 12:57:27 +00:00
|
|
|
await fixture.build();
|
2023-05-17 13:23:20 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('build successful', async () => {
|
|
|
|
expect(await fixture.readFile('../.vercel/output/static/index.html')).to.be.ok;
|
|
|
|
});
|
|
|
|
});
|