Home / File/ mdx-component.test.js — astro Source File

mdx-component.test.js — astro Source File

Architecture documentation for mdx-component.test.js, a javascript file in the astro codebase. 6 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  56a11efa_b3e6_ef5d_31aa_155c51bbb9de["mdx-component.test.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  56a11efa_b3e6_ef5d_31aa_155c51bbb9de --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  56a11efa_b3e6_ef5d_31aa_155c51bbb9de --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  56a11efa_b3e6_ef5d_31aa_155c51bbb9de --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  56a11efa_b3e6_ef5d_31aa_155c51bbb9de --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  b05fd4c1_a3ee_3301_adcd_43b49bae78f1["mdx"]
  56a11efa_b3e6_ef5d_31aa_155c51bbb9de --> b05fd4c1_a3ee_3301_adcd_43b49bae78f1
  cb315bcc_59d8_fa19_79aa_5da7cd3730c5["linkedom"]
  56a11efa_b3e6_ef5d_31aa_155c51bbb9de --> cb315bcc_59d8_fa19_79aa_5da7cd3730c5
  style 56a11efa_b3e6_ef5d_31aa_155c51bbb9de fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as assert from 'node:assert/strict';
import { after, before, describe, it } from 'node:test';
import mdx from '@astrojs/mdx';
import { parseHTML } from 'linkedom';
import { loadFixture } from '../../../astro/test/test-utils.js';

describe('MDX Component', () => {
	let fixture;

	before(async () => {
		fixture = await loadFixture({
			root: new URL('./fixtures/mdx-component/', import.meta.url),
			integrations: [mdx()],
		});
	});

	describe('build', () => {
		before(async () => {
			await fixture.build();
		});

		it('supports top-level imports', async () => {
			const html = await fixture.readFile('/index.html');
			const { document } = parseHTML(html);

			const h1 = document.querySelector('h1');
			const foo = document.querySelector('#foo');

			assert.equal(h1.textContent, 'Hello component!');
			assert.equal(foo.textContent, 'bar');
		});

		it('supports glob imports - <Component.default />', async () => {
			const html = await fixture.readFile('/glob/index.html');
			const { document } = parseHTML(html);

			const h1 = document.querySelector('[data-default-export] h1');
			const foo = document.querySelector('[data-default-export] #foo');

			assert.equal(h1.textContent, 'Hello component!');
			assert.equal(foo.textContent, 'bar');
		});

		it('supports glob imports - <Content />', async () => {
			const html = await fixture.readFile('/glob/index.html');
			const { document } = parseHTML(html);

			const h1 = document.querySelector('[data-content-export] h1');
			const foo = document.querySelector('[data-content-export] #foo');

			assert.equal(h1.textContent, 'Hello component!');
			assert.equal(foo.textContent, 'bar');
		});

		describe('with <Fragment>', () => {
			it('supports top-level imports', async () => {
				const html = await fixture.readFile('/w-fragment/index.html');
				const { document } = parseHTML(html);

				const h1 = document.querySelector('h1');
// ... (135 more lines)

Domain

Dependencies

Frequently Asked Questions

What does mdx-component.test.js do?
mdx-component.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does mdx-component.test.js depend on?
mdx-component.test.js imports 6 module(s): linkedom, loadFixture, mdx, node:test, strict, test-utils.js.
Where is mdx-component.test.js in the architecture?
mdx-component.test.js is located at packages/integrations/mdx/test/mdx-component.test.js (domain: CoreAstro, directory: packages/integrations/mdx/test).

Analyze Your Own Codebase

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

Try Supermodel Free