skew-protection.test.js — astro Source File
Architecture documentation for skew-protection.test.js, a javascript file in the astro codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR ed4e24e8_ac87_4ca3_341b_4984c0d29e72["skew-protection.test.js"] 0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"] ed4e24e8_ac87_4ca3_341b_4984c0d29e72 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15 dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"] ed4e24e8_ac87_4ca3_341b_4984c0d29e72 --> dd4f09ce_3fd7_8295_f616_8876cda4555c e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] ed4e24e8_ac87_4ca3_341b_4984c0d29e72 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 5d6d1861_a18d_b246_cd94_08889ab7e74c["promises"] ed4e24e8_ac87_4ca3_341b_4984c0d29e72 --> 5d6d1861_a18d_b246_cd94_08889ab7e74c 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] ed4e24e8_ac87_4ca3_341b_4984c0d29e72 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 style ed4e24e8_ac87_4ca3_341b_4984c0d29e72 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import * as assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { before, describe, it } from 'node:test';
import { loadFixture } from '../../../../astro/test/test-utils.js';
describe(
'Skew Protection',
() => {
let fixture;
before(async () => {
// Set DEPLOY_ID env var for the test
process.env.DEPLOY_ID = 'test-deploy-123';
fixture = await loadFixture({
root: new URL('./fixtures/skew-protection/', import.meta.url),
});
await fixture.build();
// Clean up
delete process.env.DEPLOY_ID;
});
it('Server islands inline adapter headers', async () => {
// Render a page with server islands and check the HTML contains inline headers
const entryURL = new URL(
'./fixtures/skew-protection/.netlify/v1/functions/ssr/ssr.mjs',
import.meta.url,
);
const { default: handler } = await import(entryURL);
const resp = await handler(new Request('http://example.com/server-island'), {});
const html = await resp.text();
// Check that the HTML contains the inline headers in the server island script
// Should have something like: const headers = new Headers({"X-Netlify-Deploy-ID":"test-deploy-123"});
assert.ok(
html.includes('test-deploy-123'),
'Expected server island HTML to include deploy ID in inline script',
);
});
it('Manifest contains internalFetchHeaders', async () => {
// The manifest is embedded in the build output
// Check the manifest file which contains the serialized manifest
const manifestURL = new URL(
'./fixtures/skew-protection/.netlify/build/chunks/',
import.meta.url,
);
// Find the manifest file (it has a hash in the name)
const { readdir } = await import('node:fs/promises');
const files = await readdir(manifestURL);
let found = false;
for (const file of files) {
const contents = await readFile(new URL(file, manifestURL), 'utf-8');
if (contents.includes('"internalFetchHeaders":{"X-Netlify-Deploy-ID":"test-deploy-123"}')) {
found = true;
break;
}
}
assert.ok(
found,
'Manifest should include internalFetchHeaders field with the correct deploy ID value',
);
});
},
{
timeout: 120000,
},
);
Domain
Dependencies
- loadFixture
- node:test
- promises
- strict
- test-utils.js
Source
Frequently Asked Questions
What does skew-protection.test.js do?
skew-protection.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does skew-protection.test.js depend on?
skew-protection.test.js imports 5 module(s): loadFixture, node:test, promises, strict, test-utils.js.
Where is skew-protection.test.js in the architecture?
skew-protection.test.js is located at packages/integrations/netlify/test/functions/skew-protection.test.js (domain: CoreAstro, directory: packages/integrations/netlify/test/functions).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free