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

astro-envs.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  94cd6b03_0f48_e8aa_36cf_d918c8164787["astro-envs.test.js"]
  be670a78_841c_46e5_0af5_c5c328869ecb["test-adapter.js"]
  94cd6b03_0f48_e8aa_36cf_d918c8164787 --> be670a78_841c_46e5_0af5_c5c328869ecb
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  94cd6b03_0f48_e8aa_36cf_d918c8164787 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  94cd6b03_0f48_e8aa_36cf_d918c8164787 --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  94cd6b03_0f48_e8aa_36cf_d918c8164787 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  94cd6b03_0f48_e8aa_36cf_d918c8164787 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  94cd6b03_0f48_e8aa_36cf_d918c8164787 --> deb87372_5629_35f8_9a54_e755a08f776a
  style 94cd6b03_0f48_e8aa_36cf_d918c8164787 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// @ts-check
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 } from './test-utils.js';

const root = './fixtures/astro-envs/';

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

		before(async () => {
			process.env.BOOLEAN_VAR = 'true';
			process.env.NUMBER_VAR = '1';
			fixture = await loadFixture({ root });
			await fixture.build({});
		});

		after(() => {
			delete process.env.BOOLEAN_VAR;
			delete process.env.NUMBER_VAR;
		});

		it('builds without throwing', async () => {
			assert.equal(true, true);
		});

		it('does render public env and private env', async () => {
			let indexHtml = await fixture.readFile('/index.html');

			assert.equal(indexHtml.includes('CLUB_33'), true);
			assert.equal(indexHtml.includes('BLUE_BAYOU'), true);
		});

		it('does render destructured public env and private env', async () => {
			let indexHtml = await fixture.readFile('/destructured/index.html');

			assert.equal(indexHtml.includes('CLUB_33'), true);
			assert.equal(indexHtml.includes('BLUE_BAYOU'), true);
		});

		it('does render builtin SITE env', async () => {
			let indexHtml = await fixture.readFile('/index.html');
			assert.equal(indexHtml.includes('http://example.com'), true);
		});

		it('does render destructured builtin SITE env', async () => {
			let indexHtml = await fixture.readFile('/destructured/index.html');

			assert.equal(indexHtml.includes('http://example.com'), true);
		});

		it('does render builtin BASE_URL env', async () => {
			let indexHtml = await fixture.readFile('/index.html');
			assert.equal(indexHtml.includes('/blog'), true);
		});

// ... (118 more lines)

Dependencies

Frequently Asked Questions

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