Home / File/ static-remote.test.js — astro Source File

static-remote.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  a5b613e9_78e8_fc21_c2b4_ba7db3f91d06["static-remote.test.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  a5b613e9_78e8_fc21_c2b4_ba7db3f91d06 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  a5b613e9_78e8_fc21_c2b4_ba7db3f91d06 --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  9c9ba75b_c6f1_7d10_d247_9a1ccac73501["test-utils.js"]
  a5b613e9_78e8_fc21_c2b4_ba7db3f91d06 --> 9c9ba75b_c6f1_7d10_d247_9a1ccac73501
  315dfc4b_d8ce_edad_539f_f42fcad25ec4["clearEnvironment"]
  a5b613e9_78e8_fc21_c2b4_ba7db3f91d06 --> 315dfc4b_d8ce_edad_539f_f42fcad25ec4
  ebfbc6f0_cd93_d1f3_6f95_caa77b2b7255["setupRemoteDb"]
  a5b613e9_78e8_fc21_c2b4_ba7db3f91d06 --> ebfbc6f0_cd93_d1f3_6f95_caa77b2b7255
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  a5b613e9_78e8_fc21_c2b4_ba7db3f91d06 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  a5b613e9_78e8_fc21_c2b4_ba7db3f91d06 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  a5b613e9_78e8_fc21_c2b4_ba7db3f91d06 --> deb87372_5629_35f8_9a54_e755a08f776a
  style a5b613e9_78e8_fc21_c2b4_ba7db3f91d06 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 { load as cheerioLoad } from 'cheerio';
import { loadFixture } from '../../astro/test/test-utils.js';
import { clearEnvironment, setupRemoteDb } from './test-utils.js';

describe('astro:db', () => {
	let fixture;
	before(async () => {
		fixture = await loadFixture({
			root: new URL('./fixtures/static-remote/', import.meta.url),
			output: 'static',
		});
	});

	describe('static build --remote', () => {
		let remoteDbServer;

		before(async () => {
			remoteDbServer = await setupRemoteDb(fixture.config);
			await fixture.build();
		});

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

		it('Can render page', async () => {
			const html = await fixture.readFile('/index.html');
			const $ = cheerioLoad(html);

			assert.equal($('li').length, 1);
		});

		it('Returns correct shape from db.run()', async () => {
			const html = await fixture.readFile('/run/index.html');
			const $ = cheerioLoad(html);

			assert.match($('#row').text(), /1/);
		});
	});

	describe('static build --remote with custom LibSQL', () => {
		let remoteDbServer;

		before(async () => {
			clearEnvironment();
			process.env.ASTRO_DB_REMOTE_URL = `memory:`;
			await fixture.build();
		});

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

		it('Can render page', async () => {
			const html = await fixture.readFile('/index.html');
			const $ = cheerioLoad(html);

			assert.equal($('li').length, 1);
		});

		it('Returns correct shape from db.run()', async () => {
			const html = await fixture.readFile('/run/index.html');
			const $ = cheerioLoad(html);

			assert.match($('#row').text(), /1/);
		});
	});
});

Domain

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free