Home / Function/ tocTest() — astro Function Reference

tocTest() — astro Function Reference

Architecture documentation for the tocTest() function in headings.test.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  7ac81394_4d80_f0ff_5f51_92d291e03656["tocTest()"]
  8eb7f338_d427_d8cf_1cd1_0effe3fd6b64["headings.test.js"]
  7ac81394_4d80_f0ff_5f51_92d291e03656 -->|defined in| 8eb7f338_d427_d8cf_1cd1_0effe3fd6b64
  style 7ac81394_4d80_f0ff_5f51_92d291e03656 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/markdoc/test/headings.test.js lines 213–223

function tocTest(document) {
	const toc = document.querySelector('[data-toc] > ul');
	assert.equal(toc.children.length, Object.keys(depthToHeadingMap).length);

	for (const [depth, info] of Object.entries(depthToHeadingMap)) {
		const linkEl = toc.querySelector(`a[href="#${info.slug}"]`);
		assert.ok(linkEl);
		assert.equal(linkEl.getAttribute('data-depth'), depth);
		assert.equal(linkEl.textContent.trim(), info.text);
	}
}

Domain

Subdomains

Frequently Asked Questions

What does tocTest() do?
tocTest() is a function in the astro codebase, defined in packages/integrations/markdoc/test/headings.test.js.
Where is tocTest() defined?
tocTest() is defined in packages/integrations/markdoc/test/headings.test.js at line 213.

Analyze Your Own Codebase

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

Try Supermodel Free