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

basics.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  61b195a8_5e9a_ecbe_23d4_c7c3e2aa1877["basics.test.js"]
  437168c2_a7e0_7a11_0d8b_50552999e116["test-adapter.js"]
  61b195a8_5e9a_ecbe_23d4_c7c3e2aa1877 --> 437168c2_a7e0_7a11_0d8b_50552999e116
  00a2554b_127e_f517_31a9_3bcd1edd111d["test-utils.js"]
  61b195a8_5e9a_ecbe_23d4_c7c3e2aa1877 --> 00a2554b_127e_f517_31a9_3bcd1edd111d
  a2e8916f_09d6_61ff_ee5e_719f62dea5c4["loadFixture"]
  61b195a8_5e9a_ecbe_23d4_c7c3e2aa1877 --> a2e8916f_09d6_61ff_ee5e_719f62dea5c4
  23219a20_8d8a_3f73_08e1_f29f8a50fe83["../../dist/core/utils.js"]
  61b195a8_5e9a_ecbe_23d4_c7c3e2aa1877 --> 23219a20_8d8a_3f73_08e1_f29f8a50fe83
  d70ac4ba_b920_a0c0_c4eb_ebafbe2f0230["test-utils.js"]
  61b195a8_5e9a_ecbe_23d4_c7c3e2aa1877 --> d70ac4ba_b920_a0c0_c4eb_ebafbe2f0230
  0b127513_5dae_0e1e_0af6_232a4fa5ed76["clearEnvironment"]
  61b195a8_5e9a_ecbe_23d4_c7c3e2aa1877 --> 0b127513_5dae_0e1e_0af6_232a4fa5ed76
  04fe9314_ba89_f7b9_2d94_656753c9d71a["setupRemoteDb"]
  61b195a8_5e9a_ecbe_23d4_c7c3e2aa1877 --> 04fe9314_ba89_f7b9_2d94_656753c9d71a
  0e588d0c_5409_f008_bf3b_3762dd6c1c5a["strict"]
  61b195a8_5e9a_ecbe_23d4_c7c3e2aa1877 --> 0e588d0c_5409_f008_bf3b_3762dd6c1c5a
  fa887d9d_247c_d770_d661_490745669024["node:test"]
  61b195a8_5e9a_ecbe_23d4_c7c3e2aa1877 --> fa887d9d_247c_d770_d661_490745669024
  bdfc66a8_5f37_125b_833d_b5149405ee7a["cheerio"]
  61b195a8_5e9a_ecbe_23d4_c7c3e2aa1877 --> bdfc66a8_5f37_125b_833d_b5149405ee7a
  style 61b195a8_5e9a_ecbe_23d4_c7c3e2aa1877 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 testAdapter from '../../astro/test/test-adapter.js';
import { loadFixture } from '../../astro/test/test-utils.js';
import { resolveDbAppToken } from '../dist/core/utils.js';
import { clearEnvironment, setupRemoteDb } from './test-utils.js';

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

	describe('development', () => {
		let devServer;

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

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

		it('Prints the list of authors', async () => {
			const html = await fixture.fetch('/').then((res) => res.text());
			const $ = cheerioLoad(html);

			const ul = $('.authors-list');
			assert.equal(ul.children().length, 5);
			assert.match(ul.children().eq(0).text(), /Ben/);
		});

		it('Allows expression defaults for date columns', async () => {
			const html = await fixture.fetch('/').then((res) => res.text());
			const $ = cheerioLoad(html);

			const themeAdded = $($('.themes-list .theme-added')[0]).text();
			assert.equal(Number.isNaN(new Date(themeAdded).getTime()), false);
		});

		it('Defaults can be overridden for dates', async () => {
			const html = await fixture.fetch('/').then((res) => res.text());
			const $ = cheerioLoad(html);

			const themeAdded = $($('.themes-list .theme-added')[1]).text();
			assert.equal(Number.isNaN(new Date(themeAdded).getTime()), false);
		});

		it('Allows expression defaults for text columns', async () => {
			const html = await fixture.fetch('/').then((res) => res.text());
			const $ = cheerioLoad(html);

			const themeOwner = $($('.themes-list .theme-owner')[0]).text();
// ... (172 more lines)

Dependencies

Frequently Asked Questions

What does basics.test.js do?
basics.test.js is a source file in the astro codebase, written in javascript. It belongs to the TestingInfrastructure domain.
What does basics.test.js depend on?
basics.test.js imports 10 module(s): ../../dist/core/utils.js, cheerio, clearEnvironment, loadFixture, node:test, setupRemoteDb, strict, test-adapter.js, and 2 more.
Where is basics.test.js in the architecture?
basics.test.js is located at packages/db/test/basics.test.js (domain: TestingInfrastructure, directory: packages/db/test).

Analyze Your Own Codebase

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

Try Supermodel Free