render-extends-components.test.js — astro Source File
Architecture documentation for render-extends-components.test.js, a javascript file in the astro codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR f4e5e26d_7067_20db_b527_d33758b686be["render-extends-components.test.js"] 0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"] f4e5e26d_7067_20db_b527_d33758b686be --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15 dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"] f4e5e26d_7067_20db_b527_d33758b686be --> dd4f09ce_3fd7_8295_f616_8876cda4555c e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] f4e5e26d_7067_20db_b527_d33758b686be --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] f4e5e26d_7067_20db_b527_d33758b686be --> 6b0635f9_51ea_77aa_767b_7857878e98a6 cb315bcc_59d8_fa19_79aa_5da7cd3730c5["linkedom"] f4e5e26d_7067_20db_b527_d33758b686be --> cb315bcc_59d8_fa19_79aa_5da7cd3730c5 style f4e5e26d_7067_20db_b527_d33758b686be 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';
const root = new URL('./fixtures/render-with-extends-components/', import.meta.url);
describe('Markdoc - render components defined in `extends`', () => {
let fixture;
before(async () => {
fixture = await loadFixture({
root,
});
});
describe('dev', () => {
let devServer;
before(async () => {
devServer = await fixture.startDevServer();
});
after(async () => {
await devServer.stop();
});
it('renders content - with components', async () => {
const res = await fixture.fetch('/');
const html = await res.text();
renderComponentsChecks(html);
});
});
describe('build', () => {
before(async () => {
await fixture.build();
});
it('renders content - with components', async () => {
const html = await fixture.readFile('/index.html');
renderComponentsChecks(html);
});
});
});
/** @param {string} html */
function renderComponentsChecks(html) {
const { document } = parseHTML(html);
const h2 = document.querySelector('h2');
assert.equal(h2.textContent, 'Post with components');
// Renders custom shortcode component
const marquee = document.querySelector('marquee');
assert.notEqual(marquee, null);
assert.equal(marquee.hasAttribute('data-custom-marquee'), true);
// Renders Astro Code component
const pre = document.querySelector('pre');
assert.notEqual(pre, null);
assert.equal(pre.className, 'astro-code github-dark');
// Renders 2nd Astro Code component inside if tag
const pre2 = document.querySelectorAll('pre')[1];
assert.notEqual(pre2, null);
assert.equal(pre2.className, 'astro-code github-dark');
}
Domain
Subdomains
Functions
Dependencies
- linkedom
- loadFixture
- node:test
- strict
- test-utils.js
Source
Frequently Asked Questions
What does render-extends-components.test.js do?
render-extends-components.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in render-extends-components.test.js?
render-extends-components.test.js defines 1 function(s): renderComponentsChecks.
What does render-extends-components.test.js depend on?
render-extends-components.test.js imports 5 module(s): linkedom, loadFixture, node:test, strict, test-utils.js.
Where is render-extends-components.test.js in the architecture?
render-extends-components.test.js is located at packages/integrations/markdoc/test/render-extends-components.test.js (domain: CoreAstro, subdomain: RenderingEngine, 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