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

response.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  50b1c277_e22e_4761_83d4_c623ceae91a4["response.test.js"]
  d941fcda_7a73_7111_5c8f_ff626cd2fcad["../../../dist/core/dev/container.js"]
  50b1c277_e22e_4761_83d4_c623ceae91a4 --> d941fcda_7a73_7111_5c8f_ff626cd2fcad
  be670a78_841c_46e5_0af5_c5c328869ecb["test-adapter.js"]
  50b1c277_e22e_4761_83d4_c623ceae91a4 --> be670a78_841c_46e5_0af5_c5c328869ecb
  b0be4d0c_86b6_a283_f2af_003189bfd572["test-utils.js"]
  50b1c277_e22e_4761_83d4_c623ceae91a4 --> b0be4d0c_86b6_a283_f2af_003189bfd572
  16e9d20a_70fc_8349_984c_4af9e0b840d5["createBasicSettings"]
  50b1c277_e22e_4761_83d4_c623ceae91a4 --> 16e9d20a_70fc_8349_984c_4af9e0b840d5
  f0937d94_cf30_e0fa_fbd5_135f8c876f70["createFixture"]
  50b1c277_e22e_4761_83d4_c623ceae91a4 --> f0937d94_cf30_e0fa_fbd5_135f8c876f70
  37bee138_718e_22c5_b294_37b0235244a2["createRequestAndResponse"]
  50b1c277_e22e_4761_83d4_c623ceae91a4 --> 37bee138_718e_22c5_b294_37b0235244a2
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  50b1c277_e22e_4761_83d4_c623ceae91a4 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  50b1c277_e22e_4761_83d4_c623ceae91a4 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  style 50b1c277_e22e_4761_83d4_c623ceae91a4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as assert from 'node:assert/strict';
import { after, before, describe, it } from 'node:test';
import { createContainer } from '../../../dist/core/dev/container.js';
import testAdapter from '../../test-adapter.js';
import {
	createBasicSettings,
	createFixture,
	createRequestAndResponse,
	defaultLogger,
} from '../test-utils.js';

const fileSystem = {
	'/src/pages/index.js': `export const GET = () => {
		const headers = new Headers();
		headers.append('x-single', 'single');
		headers.append('x-triple', 'one');
		headers.append('x-triple', 'two');
		headers.append('x-triple', 'three');
		headers.append('Set-cookie', 'hello');
		headers.append('Set-Cookie', 'world');
		return new Response(null, { headers });
	}`,
	'/src/pages/streaming.js': `export const GET = ({ locals }) => {
		let sentChunks = 0;

		const readableStream = new ReadableStream({
			async pull(controller) {
				if (sentChunks === 3) return controller.close();
				else sentChunks++;

				await new Promise(resolve => setTimeout(resolve, 1000));
				controller.enqueue(new TextEncoder().encode('hello'));
			},
			cancel() {
				locals.cancelledByTheServer = true;
			}
		});

		return new Response(readableStream, {
			headers: {
				"Content-Type": "text/event-stream"
			}
		})
	}`,
	'/src/pages/setCookies.js': `export const GET = context => {
		const headers = new Headers();
    context.cookies.set('key1', 'value1');
    context.cookies.set('key2', 'value2');
    headers.append('set-cookie', 'key3=value3');
    headers.append('set-cookie', 'key4=value4');
		return new Response(null, { headers });
	}`,
};

describe('endpoints', () => {
	let container;
	let settings;

	before(async () => {
		const fixture = await createFixture(fileSystem);
// ... (66 more lines)

Dependencies

Frequently Asked Questions

What does response.test.js do?
response.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does response.test.js depend on?
response.test.js imports 8 module(s): ../../../dist/core/dev/container.js, createBasicSettings, createFixture, createRequestAndResponse, node:test, strict, test-adapter.js, test-utils.js.
Where is response.test.js in the architecture?
response.test.js is located at packages/astro/test/units/vite-plugin-astro-server/response.test.js (domain: IntegrationAdapters, directory: packages/astro/test/units/vite-plugin-astro-server).

Analyze Your Own Codebase

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

Try Supermodel Free