summaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/test/static/headers.test.js
blob: 1a22e5151a6a2c57394e1eb8229504adedcc5d36 (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
import * as assert from 'node:assert/strict';
import { before, describe, it } from 'node:test';
import { loadFixture } from '@astrojs/test-utils';

describe('SSG - headers', () => {
	let fixture;

	before(async () => {
		fixture = await loadFixture({ root: new URL('./fixtures/redirects/', import.meta.url) });
		await fixture.build();
	});

	it('Generates headers for static assets', async () => {
		const config = await fixture.readFile('../.netlify/v1/config.json');
		const headers = JSON.parse(config).headers;
		assert.deepEqual(headers, [
			{
				for: '/_astro/*',
				values: {
					'Cache-Control': 'public, max-age=31536000, immutable',
				},
			},
		]);
	});
});