summaryrefslogtreecommitdiff
path: root/packages/astro/test/ssr-manifest.test.js
blob: bd9483505b799aaf277048158ce0ca7d4f90cb80 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { expect } from 'chai';
import { loadFixture } from './test-utils.js';
import testAdapter from './test-adapter.js';
import * as cheerio from 'cheerio';

describe('astro:ssr-manifest', () => {
	/** @type {import('./test-utils').Fixture} */
	let fixture;

	before(async () => {
		fixture = await loadFixture({
			root: './fixtures/ssr-manifest/',
			output: 'server',
			adapter: testAdapter(),
		});
		await fixture.build();
	});

	it('works', async () => {
		const app = await fixture.loadTestAdapterApp();
		const request = new Request('http://example.com/');
		const response = await app.render(request);
		const html = await response.text();

		const $ = cheerio.load(html);
		expect($('#assets').text()).to.equal('["/_astro/index.a8a337e4.css"]');
	});

	it('includes compressHTML', async () => {
		const app = await fixture.loadTestAdapterApp();
		expect(app.manifest).to.haveOwnProperty('compressHTML');
		expect(app.manifest.compressHTML).to.be.true;
	});
});