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

astro-markdown.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  2dac945c_e00e_b5f7_9fac_2ff2813523aa["astro-markdown.test.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  2dac945c_e00e_b5f7_9fac_2ff2813523aa --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  beb21e0a_5a04_1aeb_f065_5ab6c5ffe2ea["fixLineEndings"]
  2dac945c_e00e_b5f7_9fac_2ff2813523aa --> beb21e0a_5a04_1aeb_f065_5ab6c5ffe2ea
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  2dac945c_e00e_b5f7_9fac_2ff2813523aa --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  2dac945c_e00e_b5f7_9fac_2ff2813523aa --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  2dac945c_e00e_b5f7_9fac_2ff2813523aa --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  2dac945c_e00e_b5f7_9fac_2ff2813523aa --> deb87372_5629_35f8_9a54_e755a08f776a
  style 2dac945c_e00e_b5f7_9fac_2ff2813523aa 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 { fixLineEndings, loadFixture } from './test-utils.js';

const FIXTURE_ROOT = './fixtures/astro-markdown/';

describe('Astro Markdown', () => {
	let fixture;

	before(async () => {
		fixture = await loadFixture({
			root: FIXTURE_ROOT,
		});
		await fixture.build();
	});

	it('Exposes raw markdown content', async () => {
		const { raw } = JSON.parse(await fixture.readFile('/raw-content.json'));

		assert.equal(
			fixLineEndings(raw).trim(),
			`# Basic page\n\nLets make sure raw and compiled content look right!`,
		);
	});

	it('Allows ?raw and ?url imports', async () => {
		const { rawImport, url } = JSON.parse(await fixture.readFile('/raw-content.json'));
		assert.equal(
			fixLineEndings(rawImport).trim(),
			`# Basic page\n\nLets make sure raw and compiled content look right!`,
		);
		assert.ok(url.startsWith('data:text/markdown;base64,'));
	});

	it('Exposes compiled HTML content', async () => {
		const { compiled } = JSON.parse(await fixture.readFile('/raw-content.json'));

		assert.equal(
			fixLineEndings(compiled).trim(),
			`<h1 id="basic-page">Basic page</h1>\n<p>Lets make sure raw and compiled content look right!</p>`,
		);
	});

	describe('syntax highlighting', async () => {
		it('handles Shiki', async () => {
			const html = await fixture.readFile('/code-in-md/index.html');
			const $ = cheerio.load(html);

			assert.notEqual($('pre.astro-code').length, 0);
		});

		it('handles Prism', async () => {
			const prismFixture = await loadFixture({
				root: FIXTURE_ROOT,
				markdown: {
					syntaxHighlight: 'prism',
				},
			});
			await prismFixture.build();
// ... (127 more lines)

Dependencies

Frequently Asked Questions

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