Home / File/ astro-env.test.js — astro Source File

astro-env.test.js — astro Source File

Architecture documentation for astro-env.test.js, a javascript file in the astro codebase. 5 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  6e447c0f_5b60_9bad_dfbf_bc64627f1675["astro-env.test.js"]
  635e1221_67bb_e784_624a_d6d63643872b["_test-utils.js"]
  6e447c0f_5b60_9bad_dfbf_bc64627f1675 --> 635e1221_67bb_e784_624a_d6d63643872b
  33b9a01d_12ac_568f_9775_9e80b35139cb["loadFixture"]
  6e447c0f_5b60_9bad_dfbf_bc64627f1675 --> 33b9a01d_12ac_568f_9775_9e80b35139cb
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  6e447c0f_5b60_9bad_dfbf_bc64627f1675 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  6e447c0f_5b60_9bad_dfbf_bc64627f1675 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  6e447c0f_5b60_9bad_dfbf_bc64627f1675 --> deb87372_5629_35f8_9a54_e755a08f776a
  style 6e447c0f_5b60_9bad_dfbf_bc64627f1675 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 * as cheerio from 'cheerio';
import { loadFixture } from './_test-utils.js';

describe('astro:env', () => {
	describe('ssr', () => {
		let fixture;
		let previewServer;

		before(async () => {
			process.env.API_URL = 'https://google.de';
			process.env.PORT = '4322';
			fixture = await loadFixture({
				root: './fixtures/astro-env/',
			});
			await fixture.build();
			previewServer = await fixture.preview();
		});

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

		it('runtime', async () => {
			const res = await fixture.fetch('/');
			const html = await res.text();
			const $ = cheerio.load(html);
			assert.equal(
				$('#runtime').text().includes('https://google.de') &&
					$('#runtime').text().includes('4322') &&
					$('#runtime').text().includes('123456789'),
				true,
			);
		});

		it('client', async () => {
			const res = await fixture.fetch('/');
			const html = await res.text();
			const $ = cheerio.load(html);
			assert.equal($('#client').text().includes('https://google.de'), true);
		});

		it('server', async () => {
			const res = await fixture.fetch('/');
			const html = await res.text();
			const $ = cheerio.load(html);
			assert.equal($('#server').text().includes('4322'), true);
		});

		it('secret', async () => {
			const res = await fixture.fetch('/');
			const html = await res.text();
			const $ = cheerio.load(html);
			assert.equal($('#secret').text().includes('123456789'), true);
		});

		it('action secret', async () => {
			const res = await fixture.fetch('/test');
			const html = await res.text();
// ... (63 more lines)

Domain

Dependencies

Frequently Asked Questions

What does astro-env.test.js do?
astro-env.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does astro-env.test.js depend on?
astro-env.test.js imports 5 module(s): _test-utils.js, cheerio, loadFixture, node:test, strict.
Where is astro-env.test.js in the architecture?
astro-env.test.js is located at packages/integrations/cloudflare/test/astro-env.test.js (domain: CoreAstro, directory: packages/integrations/cloudflare/test).

Analyze Your Own Codebase

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

Try Supermodel Free