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

streaming.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  8f7c0e73_cba7_d459_f2cb_d8b1b7f0e1f5["streaming.test.js"]
  be670a78_841c_46e5_0af5_c5c328869ecb["test-adapter.js"]
  8f7c0e73_cba7_d459_f2cb_d8b1b7f0e1f5 --> be670a78_841c_46e5_0af5_c5c328869ecb
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  8f7c0e73_cba7_d459_f2cb_d8b1b7f0e1f5 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  8f7c0e73_cba7_d459_f2cb_d8b1b7f0e1f5 --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  381258ab_0967_3013_5710_462a27098a65["streamAsyncIterator"]
  8f7c0e73_cba7_d459_f2cb_d8b1b7f0e1f5 --> 381258ab_0967_3013_5710_462a27098a65
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  8f7c0e73_cba7_d459_f2cb_d8b1b7f0e1f5 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  8f7c0e73_cba7_d459_f2cb_d8b1b7f0e1f5 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  8f7c0e73_cba7_d459_f2cb_d8b1b7f0e1f5 --> deb87372_5629_35f8_9a54_e755a08f776a
  style 8f7c0e73_cba7_d459_f2cb_d8b1b7f0e1f5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import assert from 'node:assert/strict';
import { after, before, describe, it } from 'node:test';
import * as cheerio from 'cheerio';
import testAdapter from './test-adapter.js';
import { loadFixture, streamAsyncIterator } from './test-utils.js';

describe('Streaming', () => {
	/** @type {import('./test-utils').Fixture} */
	let fixture;

	let decoder = new TextDecoder();

	before(async () => {
		fixture = await loadFixture({
			root: './fixtures/streaming/',
			adapter: testAdapter(),
			output: 'server',
		});
	});

	describe('Development', () => {
		/** @type {import('./test-utils').DevServer} */
		let devServer;

		before(async () => {
			devServer = await fixture.startDevServer();
		});

		after(async () => {
			await devServer.stop();
		});

		it('Body is chunked', async () => {
			let res = await fixture.fetch('/');
			let chunks = [];
			for await (const bytes of streamAsyncIterator(res.body)) {
				let chunk = decoder.decode(bytes);
				chunks.push(chunk);
			}
			assert.equal(chunks.length > 5, true);
		});

		it('Body of slots is chunked', async () => {
			let res = await fixture.fetch('/slot');
			let chunks = [];
			for await (const bytes of streamAsyncIterator(res.body)) {
				let chunk = decoder.decode(bytes);
				chunks.push(chunk);
			}
			assert.ok(chunks.length >= 2);
		});
	});

	describe('Production', () => {
		before(async () => {
			await fixture.build();
		});

		it('Can get the full html body', async () => {
			const app = await fixture.loadTestAdapterApp();
// ... (97 more lines)

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free