Home / File/ static-headers.test.js — astro Source File

static-headers.test.js — astro Source File

Architecture documentation for static-headers.test.js, a javascript file in the astro codebase. 4 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  02136adb_3a6a_7ee8_5594_5783ff59c705["static-headers.test.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  02136adb_3a6a_7ee8_5594_5783ff59c705 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  02136adb_3a6a_7ee8_5594_5783ff59c705 --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  02136adb_3a6a_7ee8_5594_5783ff59c705 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  02136adb_3a6a_7ee8_5594_5783ff59c705 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  style 02136adb_3a6a_7ee8_5594_5783ff59c705 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as assert from 'node:assert/strict';
import { before, describe, it } from 'node:test';
import { loadFixture } from '../../../../astro/test/test-utils.js';

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

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

	it('CSP headers are added when CSP is enabled', async () => {
		const config = await fixture.readFile('../.netlify/v1/config.json');
		const headers = JSON.parse(config).headers;
		const index = headers.find((x) => x.for === '/');

		assert.notEqual(index, undefined, 'the index must have CSP headers');
		assert.notEqual(
			index.values['Content-Security-Policy'],
			undefined,
			'the index must have CSP headers',
		);
		assert.ok(
			index.values['Content-Security-Policy'].includes('script-src'),
			'must contain the script-src directive because of the server island',
		);
	});
});

Domain

Dependencies

Frequently Asked Questions

What does static-headers.test.js do?
static-headers.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does static-headers.test.js depend on?
static-headers.test.js imports 4 module(s): loadFixture, node:test, strict, test-utils.js.
Where is static-headers.test.js in the architecture?
static-headers.test.js is located at packages/integrations/netlify/test/static/static-headers.test.js (domain: CoreAstro, directory: packages/integrations/netlify/test/static).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free