Home / File/ dev.test.js — astro Source File

dev.test.js — astro Source File

Architecture documentation for dev.test.js, a javascript file in the astro codebase. 7 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  bb7b4b23_873e_68d3_9caa_2cec5c83b3fc["dev.test.js"]
  b0be4d0c_86b6_a283_f2af_003189bfd572["test-utils.js"]
  bb7b4b23_873e_68d3_9caa_2cec5c83b3fc --> b0be4d0c_86b6_a283_f2af_003189bfd572
  f0937d94_cf30_e0fa_fbd5_135f8c876f70["createFixture"]
  bb7b4b23_873e_68d3_9caa_2cec5c83b3fc --> f0937d94_cf30_e0fa_fbd5_135f8c876f70
  37bee138_718e_22c5_b294_37b0235244a2["createRequestAndResponse"]
  bb7b4b23_873e_68d3_9caa_2cec5c83b3fc --> 37bee138_718e_22c5_b294_37b0235244a2
  f09af995_6d60_a9f3_bdf0_6ae561f198cb["runInContainer"]
  bb7b4b23_873e_68d3_9caa_2cec5c83b3fc --> f09af995_6d60_a9f3_bdf0_6ae561f198cb
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  bb7b4b23_873e_68d3_9caa_2cec5c83b3fc --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  bb7b4b23_873e_68d3_9caa_2cec5c83b3fc --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  bb7b4b23_873e_68d3_9caa_2cec5c83b3fc --> deb87372_5629_35f8_9a54_e755a08f776a
  style bb7b4b23_873e_68d3_9caa_2cec5c83b3fc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import * as cheerio from 'cheerio';
import { createFixture, createRequestAndResponse, runInContainer } from '../test-utils.js';

describe('dev container', () => {
	it('can render requests', async () => {
		const fixture = await createFixture({
			'/src/pages/index.astro': `
				---
				const name = 'Testing';
				---
				<html>
					<head><title>{name}</title></head>
					<body>
						<h1>{name}</h1>
					</body>
				</html>
			`,
		});

		await runInContainer({ inlineConfig: { root: fixture.path } }, async (container) => {
			const { req, res, text } = createRequestAndResponse({
				method: 'GET',
				url: '/',
			});
			container.handle(req, res);
			const html = await text();
			const $ = cheerio.load(html);
			assert.equal(res.statusCode, 200);
			assert.equal($('h1').length, 1);
		});
	});

	it('Allows dynamic segments in injected routes', async () => {
		const fixture = await createFixture({
			'/src/components/test.astro': `<h1>{Astro.params.slug}</h1>`,
			'/src/pages/test-[slug].astro': `<h1>{Astro.params.slug}</h1>`,
		});

		await runInContainer(
			{
				inlineConfig: {
					root: fixture.path,
					output: 'server',
					integrations: [
						{
							name: '@astrojs/test-integration',
							hooks: {
								'astro:config:setup': ({ injectRoute }) => {
									injectRoute({
										pattern: '/another-[slug]',
										entrypoint: './src/components/test.astro',
									});
								},
							},
						},
					],
				},
			},
// ... (137 more lines)

Frequently Asked Questions

What does dev.test.js do?
dev.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does dev.test.js depend on?
dev.test.js imports 7 module(s): cheerio, createFixture, createRequestAndResponse, node:test, runInContainer, strict, test-utils.js.
Where is dev.test.js in the architecture?
dev.test.js is located at packages/astro/test/units/dev/dev.test.js (domain: IntegrationAdapters, directory: packages/astro/test/units/dev).

Analyze Your Own Codebase

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

Try Supermodel Free