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
|
|
|
|
|
|
|
it('includeFiles work', async () => {
|
|
|
|
expect(
|
|
|
|
await fixture.readFile(
|
|
|
|
'../.vercel/output/functions/render.func/packages/integrations/vercel/test/fixtures/serverless-prerender/included.js'
|
|
|
|
)
|
|
|
|
).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;
|
|
|
|
});
|
|
|
|
});
|