ssr-script.test.js — astro Source File
Architecture documentation for ssr-script.test.js, a javascript file in the astro codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 80307b9d_fcb1_e6b2_e30b_5d74e2d07c06["ssr-script.test.js"] be670a78_841c_46e5_0af5_c5c328869ecb["test-adapter.js"] 80307b9d_fcb1_e6b2_e30b_5d74e2d07c06 --> be670a78_841c_46e5_0af5_c5c328869ecb 0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"] 80307b9d_fcb1_e6b2_e30b_5d74e2d07c06 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15 dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"] 80307b9d_fcb1_e6b2_e30b_5d74e2d07c06 --> dd4f09ce_3fd7_8295_f616_8876cda4555c e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] 80307b9d_fcb1_e6b2_e30b_5d74e2d07c06 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] 80307b9d_fcb1_e6b2_e30b_5d74e2d07c06 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 deb87372_5629_35f8_9a54_e755a08f776a["cheerio"] 80307b9d_fcb1_e6b2_e30b_5d74e2d07c06 --> deb87372_5629_35f8_9a54_e755a08f776a style 80307b9d_fcb1_e6b2_e30b_5d74e2d07c06 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import assert from 'node:assert/strict';
import { before, describe, it } from 'node:test';
import { load as cheerioLoad } from 'cheerio';
import testAdapter from './test-adapter.js';
import { loadFixture } from './test-utils.js';
async function fetchHTML(fixture, path) {
const app = await fixture.loadTestAdapterApp();
const request = new Request('http://example.com' + path);
const response = await app.render(request);
const html = await response.text();
return html;
}
/** @type {import('./test-utils.js').AstroInlineConfig} */
const defaultFixtureOptions = {
root: './fixtures/ssr-script/',
output: 'server',
adapter: testAdapter(),
};
describe('Inline scripts in SSR', () => {
/** @type {import('./test-utils.js').Fixture} */
let fixture;
describe('without base path', () => {
before(async () => {
fixture = await loadFixture({
...defaultFixtureOptions,
outDir: './dist/inline-scripts-without-base-path',
});
await fixture.build();
});
it('scripts get included', async () => {
const html = await fetchHTML(fixture, '/');
const $ = cheerioLoad(html);
assert.equal($('script').length, 1);
});
});
describe('with base path', () => {
const base = '/hello';
before(async () => {
fixture = await loadFixture({
...defaultFixtureOptions,
outDir: './dist/inline-scripts-with-base-path',
base,
});
await fixture.build();
});
it('Inlined scripts get included without base path in the script', async () => {
const html = await fetchHTML(fixture, '/hello/');
const $ = cheerioLoad(html);
assert.equal($('script').html(), 'console.log("hello world");');
});
});
});
// ... (182 more lines)
Domain
Subdomains
Functions
Dependencies
- cheerio
- loadFixture
- node:test
- strict
- test-adapter.js
- test-utils.js
Source
Frequently Asked Questions
What does ssr-script.test.js do?
ssr-script.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain, SsrAdapters subdomain.
What functions are defined in ssr-script.test.js?
ssr-script.test.js defines 1 function(s): fetchHTML.
What does ssr-script.test.js depend on?
ssr-script.test.js imports 6 module(s): cheerio, loadFixture, node:test, strict, test-adapter.js, test-utils.js.
Where is ssr-script.test.js in the architecture?
ssr-script.test.js is located at packages/astro/test/ssr-script.test.js (domain: IntegrationAdapters, subdomain: SsrAdapters, directory: packages/astro/test).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free