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

hydration.test.js — astro Source File

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

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

describe('hydration', () => {
	it(
		'should not crash when reassigning a hydrated component',
		{ skip: true, todo: "It seems that `components/Client.svelte` isn't found" },
		async () => {
			const fixture = await createFixture({
				'/src/pages/index.astro': `
				---
				import Svelte from '../components/Client.svelte';
				const Foo = Svelte;
				const Bar = Svelte;
				---
				<html>
					<head><title>testing</title></head>
					<body>
						<Foo client:load />
						<Bar client:load />
					</body>
				</html>
			`,
			});

			await runInContainer(
				{
					inlineConfig: {
						root: fixture.path,
						logLevel: 'silent',
					},
				},
				async (container) => {
					const { req, res, done } = createRequestAndResponse({
						method: 'GET',
						url: '/',
					});
					container.handle(req, res);
					await done;
					assert.equal(
						res.statusCode,
						200,
						"We get a 200 because the error occurs in the template, but we didn't crash!",
					);
				},
			);
		},
	);
});

Frequently Asked Questions

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