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

headings.test.js — astro Source File

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

File javascript CoreAstro RoutingSystem 5 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  8eb7f338_d427_d8cf_1cd1_0effe3fd6b64["headings.test.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  8eb7f338_d427_d8cf_1cd1_0effe3fd6b64 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  8eb7f338_d427_d8cf_1cd1_0effe3fd6b64 --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  8eb7f338_d427_d8cf_1cd1_0effe3fd6b64 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  8eb7f338_d427_d8cf_1cd1_0effe3fd6b64 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  cb315bcc_59d8_fa19_79aa_5da7cd3730c5["linkedom"]
  8eb7f338_d427_d8cf_1cd1_0effe3fd6b64 --> cb315bcc_59d8_fa19_79aa_5da7cd3730c5
  style 8eb7f338_d427_d8cf_1cd1_0effe3fd6b64 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 { parseHTML } from 'linkedom';
import { loadFixture } from '../../../astro/test/test-utils.js';

async function getFixture(name) {
	return await loadFixture({
		root: new URL(`./fixtures/${name}/`, import.meta.url),
	});
}

describe('Markdoc - Headings', () => {
	let fixture;

	before(async () => {
		fixture = await getFixture('headings');
	});

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

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

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

		it('applies IDs to headings', async () => {
			const res = await fixture.fetch('/headings');
			const html = await res.text();
			const { document } = parseHTML(html);

			idTest(document);
		});

		it('applies IDs to headings containing special characters', async () => {
			const res = await fixture.fetch('/headings-with-special-characters');
			const html = await res.text();
			const { document } = parseHTML(html);

			assert.equal(document.querySelector('h2')?.id, 'picture-');
			assert.equal(document.querySelector('h3')?.id, '-sacrebleu--');
		});

		it('generates the same IDs for other documents with the same headings', async () => {
			const res = await fixture.fetch('/headings-stale-cache-check');
			const html = await res.text();
			const { document } = parseHTML(html);

			idTest(document);
		});

		it('generates a TOC with correct info', async () => {
			const res = await fixture.fetch('/headings');
			const html = await res.text();
			const { document } = parseHTML(html);

			tocTest(document);
// ... (173 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does headings.test.js do?
headings.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain, RoutingSystem subdomain.
What functions are defined in headings.test.js?
headings.test.js defines 4 function(s): astroComponentTest, getFixture, idTest, tocTest.
What does headings.test.js depend on?
headings.test.js imports 5 module(s): linkedom, loadFixture, node:test, strict, test-utils.js.
Where is headings.test.js in the architecture?
headings.test.js is located at packages/integrations/markdoc/test/headings.test.js (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/integrations/markdoc/test).

Analyze Your Own Codebase

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

Try Supermodel Free