astro/packages/integrations/cloudflare/test/prerender.test.js
Erika b76c166bdd
feat: unflag experimental.assets (#7921)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
2023-08-16 10:21:05 +02:00

58 lines
1.2 KiB
JavaScript

import { loadFixture } from './test-utils.js';
import { expect } from 'chai';
describe('Prerendering', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
before(async () => {
process.env.PRERENDER = true;
fixture = await loadFixture({
root: './fixtures/prerender/',
});
await fixture.build();
});
after(() => {
delete process.env.PRERENDER;
fixture.clean();
});
it('includes non prerendered routes in the routes.json config', async () => {
const foundRoutes = JSON.parse(await fixture.readFile('/_routes.json'));
expect(foundRoutes).to.deep.equal({
version: 1,
include: ['/', '/_image'],
exclude: [],
});
});
});
describe('Hybrid rendering', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
before(async () => {
process.env.PRERENDER = false;
fixture = await loadFixture({
root: './fixtures/prerender/',
output: 'hybrid',
});
await fixture.build();
});
after(() => {
delete process.env.PRERENDER;
});
it('includes non prerendered routes in the routes.json config', async () => {
const foundRoutes = JSON.parse(await fixture.readFile('/_routes.json'));
expect(foundRoutes).to.deep.equal({
version: 1,
include: ['/one', '/_image'],
exclude: [],
});
});
});