astro-component-code.test.js — astro Source File
Architecture documentation for astro-component-code.test.js, a javascript file in the astro codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 5bca90ae_cdcf_378e_5d3e_9a392798fb22["astro-component-code.test.js"] 0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"] 5bca90ae_cdcf_378e_5d3e_9a392798fb22 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15 dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"] 5bca90ae_cdcf_378e_5d3e_9a392798fb22 --> dd4f09ce_3fd7_8295_f616_8876cda4555c e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] 5bca90ae_cdcf_378e_5d3e_9a392798fb22 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] 5bca90ae_cdcf_378e_5d3e_9a392798fb22 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 deb87372_5629_35f8_9a54_e755a08f776a["cheerio"] 5bca90ae_cdcf_378e_5d3e_9a392798fb22 --> deb87372_5629_35f8_9a54_e755a08f776a style 5bca90ae_cdcf_378e_5d3e_9a392798fb22 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('<Code>', () => {
let fixture;
before(async () => {
fixture = await loadFixture({ root: './fixtures/astro-component-code/' });
await fixture.build();
});
it('<Code> without lang or theme', async () => {
let html = await fixture.readFile('/no-lang/index.html');
const $ = cheerio.load(html);
assert.equal($('pre').length, 1);
assert.equal(
$('pre').attr('style'),
'background-color:#24292e;color:#e1e4e8; overflow-x: auto;',
'applies default and overflow',
);
assert.equal($('pre > code').length, 1);
// test: contains some generated spans
assert.equal($('pre > code span').length > 1, true);
});
it('<Code lang="...">', async () => {
let html = await fixture.readFile('/basic/index.html');
const $ = cheerio.load(html);
assert.equal($('pre').length, 1);
assert.equal($('pre').attr('class'), 'astro-code github-dark');
assert.equal($('pre > code').length, 1);
// test: contains many generated spans
assert.equal($('pre > code span').length >= 6, true);
});
it('<Code theme="...">', async () => {
let html = await fixture.readFile('/custom-theme/index.html');
const $ = cheerio.load(html);
assert.equal($('pre').length, 1);
assert.equal($('pre').attr('class'), 'astro-code nord');
assert.equal(
$('pre').attr('style'),
'background-color:#2e3440ff;color:#d8dee9ff; overflow-x: auto;',
'applies custom theme',
);
});
it('<Code wrap>', async () => {
{
let html = await fixture.readFile('/wrap-true/index.html');
const $ = cheerio.load(html);
assert.equal($('pre').length, 1);
// test: applies wrap overflow
assert.equal(
$('pre').attr('style'),
'background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;',
);
// ... (65 more lines)
Domain
Dependencies
- cheerio
- loadFixture
- node:test
- strict
- test-utils.js
Source
Frequently Asked Questions
What does astro-component-code.test.js do?
astro-component-code.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does astro-component-code.test.js depend on?
astro-component-code.test.js imports 5 module(s): cheerio, loadFixture, node:test, strict, test-utils.js.
Where is astro-component-code.test.js in the architecture?
astro-component-code.test.js is located at packages/astro/test/astro-component-code.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