2023-02-21 09:14:47 -05:00
|
|
|
import { expect } from 'chai';
|
2023-05-02 02:42:48 -05:00
|
|
|
import { loadFixture } from './test-utils.js';
|
2023-02-21 09:14:47 -05:00
|
|
|
|
|
|
|
describe('Serverless prerender', () => {
|
|
|
|
/** @type {import('./test-utils').Fixture} */
|
|
|
|
let fixture;
|
|
|
|
|
|
|
|
before(async () => {
|
2023-05-17 08:23:20 -05:00
|
|
|
process.env.PRERENDER = true;
|
2023-02-21 09:14:47 -05:00
|
|
|
fixture = await loadFixture({
|
|
|
|
root: './fixtures/serverless-prerender/',
|
|
|
|
});
|
2023-07-17 07:57:27 -05:00
|
|
|
await fixture.build();
|
2023-02-21 09:14:47 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('build successful', async () => {
|
2023-05-02 02:42:48 -05:00
|
|
|
expect(await fixture.readFile('../.vercel/output/static/index.html')).to.be.ok;
|
2023-02-21 09:14:47 -05:00
|
|
|
});
|
2023-07-17 07:57:27 -05: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 09:14:47 -05:00
|
|
|
});
|
2023-05-17 08:23:20 -05: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 08:26:03 -05:00
|
|
|
output: 'hybrid',
|
2023-05-17 08:23:20 -05:00
|
|
|
});
|
2023-07-17 07:57:27 -05:00
|
|
|
await fixture.build();
|
2023-05-17 08:23:20 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('build successful', async () => {
|
|
|
|
expect(await fixture.readFile('../.vercel/output/static/index.html')).to.be.ok;
|
|
|
|
});
|
|
|
|
});
|