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

jsx.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  ecaccb02_6519_34c8_a1aa_f7970c430608["jsx.test.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  ecaccb02_6519_34c8_a1aa_f7970c430608 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  ecaccb02_6519_34c8_a1aa_f7970c430608 --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  ecaccb02_6519_34c8_a1aa_f7970c430608 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  ecaccb02_6519_34c8_a1aa_f7970c430608 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  ecaccb02_6519_34c8_a1aa_f7970c430608 --> deb87372_5629_35f8_9a54_e755a08f776a
  style ecaccb02_6519_34c8_a1aa_f7970c430608 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import assert from 'node:assert/strict';
import { before, describe, it } from 'node:test';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';

describe('jsx-runtime', () => {
	let fixture;

	before(async () => {
		fixture = await loadFixture({
			root: './fixtures/jsx/',
		});
		await fixture.build();
	});

	it('Can load simple JSX components', async () => {
		const html = await fixture.readFile('/component/index.html');
		const $ = cheerio.load(html);

		assert.equal($('#basic').text(), 'Basic');
		assert.equal($('#named').text(), 'Named');
	});

	it('Can load Preact component inside Astro', async () => {
		const html = await fixture.readFile('/frameworks/index.html');
		const $ = cheerio.load(html);

		assert.equal($('#has-preact #preact').length, 0);
		assert.equal($('#preact').text().includes('Preact'), true);
	});

	it('Can load React component inside Astro', async () => {
		const html = await fixture.readFile('/frameworks/index.html');
		const $ = cheerio.load(html);

		assert.equal($('#has-react #react').length, 0);
		assert.equal($('#react').text().includes('React'), true);
	});

	it('Can load Solid component inside Astro', async () => {
		const html = await fixture.readFile('/frameworks/index.html');
		const $ = cheerio.load(html);

		assert.equal($('#has-solid #solid').length, 0);
		assert.equal($('#solid').text().includes('Solid'), true);
	});

	it('Can load Svelte component inside Astro', async () => {
		const html = await fixture.readFile('/frameworks/index.html');
		const $ = cheerio.load(html);

		assert.equal($('#has-svelte #svelte').length, 0);
		assert.equal($('#svelte').text().includes('Svelte'), true);
	});

	it('Can load Vue component inside Astro', async () => {
		const html = await fixture.readFile('/frameworks/index.html');
		const $ = cheerio.load(html);

		assert.equal($('#has-vue #vue').length, 0);
		assert.equal($('#vue').text().includes('Vue'), true);
	});

	it('Can load MDX component inside Astro', async () => {
		const html = await fixture.readFile('/frameworks/index.html');
		const $ = cheerio.load(html);

		assert.equal($('#mdx-wrapper #hello-world').length, 1, 'md content rendered');
		assert.equal($('#mdx-wrapper #react').length, 1, 'React component rendered');
	});
});

Dependencies

Frequently Asked Questions

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