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

astro-basic.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  f0972392_bca0_3141_69a5_4dfb80812919["astro-basic.test.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  f0972392_bca0_3141_69a5_4dfb80812919 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  f0972392_bca0_3141_69a5_4dfb80812919 --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  68407ce2_f297_0f69_e923_be3697615739["test-prerenderer.js"]
  f0972392_bca0_3141_69a5_4dfb80812919 --> 68407ce2_f297_0f69_e923_be3697615739
  eec5e111_2dfc_6808_4911_a2c543b8464f["createTestPrerenderer"]
  f0972392_bca0_3141_69a5_4dfb80812919 --> eec5e111_2dfc_6808_4911_a2c543b8464f
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  f0972392_bca0_3141_69a5_4dfb80812919 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  f0972392_bca0_3141_69a5_4dfb80812919 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  f0972392_bca0_3141_69a5_4dfb80812919 --> deb87372_5629_35f8_9a54_e755a08f776a
  style f0972392_bca0_3141_69a5_4dfb80812919 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 * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
import createTestPrerenderer from './test-prerenderer.js';

describe('Astro basic build', () => {
	/** @type {import('./test-utils').Fixture} */
	let fixture;

	let previewServer;

	before(async () => {
		fixture = await loadFixture({
			root: './fixtures/astro-basic/',
		});
		await fixture.build();
		previewServer = await fixture.preview();
	});

	// important: close preview server (free up port and connection)
	after(async () => {
		await previewServer.stop();
	});

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

		assert.equal($('h1').text(), 'Hello world!');
	});

	it('Correctly serializes boolean attributes', async () => {
		const html = await fixture.readFile('/index.html');
		const $ = cheerio.load(html);

		assert.equal($('h1').attr('data-something'), '');
		assert.equal($('h2').attr('not-data-ok'), '');
	});

	it('Selector with an empty body', async () => {
		const html = await fixture.readFile('/empty-class/index.html');
		const $ = cheerio.load(html);

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

	it('Allows forward-slashes in mustache tags (#407)', async () => {
		const html = await fixture.readFile('/forward-slash/index.html');
		const $ = cheerio.load(html);

		assert.equal($('a[href="/post/one"]').length, 1);
		assert.equal($('a[href="/post/two"]').length, 1);
		assert.equal($('a[href="/post/three"]').length, 1);
	});

	it('Allows spread attributes (#521)', async () => {
		const html = await fixture.readFile('/spread/index.html');
		const $ = cheerio.load(html);

// ... (206 more lines)

Frequently Asked Questions

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