astro-assets-prefix.test.js — astro Source File
Architecture documentation for astro-assets-prefix.test.js, a javascript file in the astro codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 65016ab9_b5f8_83ba_c1a0_fe950249c16f["astro-assets-prefix.test.js"] be670a78_841c_46e5_0af5_c5c328869ecb["test-adapter.js"] 65016ab9_b5f8_83ba_c1a0_fe950249c16f --> be670a78_841c_46e5_0af5_c5c328869ecb 0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"] 65016ab9_b5f8_83ba_c1a0_fe950249c16f --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15 dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"] 65016ab9_b5f8_83ba_c1a0_fe950249c16f --> dd4f09ce_3fd7_8295_f616_8876cda4555c e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] 65016ab9_b5f8_83ba_c1a0_fe950249c16f --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] 65016ab9_b5f8_83ba_c1a0_fe950249c16f --> 6b0635f9_51ea_77aa_767b_7857878e98a6 deb87372_5629_35f8_9a54_e755a08f776a["cheerio"] 65016ab9_b5f8_83ba_c1a0_fe950249c16f --> deb87372_5629_35f8_9a54_e755a08f776a style 65016ab9_b5f8_83ba_c1a0_fe950249c16f 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 testAdapter from './test-adapter.js';
import { loadFixture } from './test-utils.js';
const assetsPrefix = 'http://localhost:4321';
const assetsPrefixRegex = /^http:\/\/localhost:4321\/_astro\/.*/;
// Asset prefix for CDN support
describe('Assets Prefix - Static', () => {
let fixture;
before(async () => {
fixture = await loadFixture({
root: './fixtures/astro-assets-prefix/',
outDir: './dist/static',
});
await fixture.build();
});
after(async () => {
await fixture.clean();
});
it('all stylesheets should start with assetPrefix', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
const stylesheets = $('link[rel="stylesheet"]');
stylesheets.each((_i, el) => {
assert.match(el.attribs.href, assetsPrefixRegex);
});
});
it('image src start with assetsPrefix', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
const imgAsset = $('#image-asset');
assert.match(imgAsset.attr('src'), assetsPrefixRegex);
});
it('react component astro-island should import from assetsPrefix', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
const island = $('astro-island');
assert.match(island.attr('component-url'), assetsPrefixRegex);
assert.match(island.attr('renderer-url'), assetsPrefixRegex);
});
it('import.meta.env.ASSETS_PREFIX works', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
const env = $('#assets-prefix-env');
assert.equal(env.text(), assetsPrefix);
});
it('markdown image src start with assetsPrefix', async () => {
const html = await fixture.readFile('/markdown/index.html');
const $ = cheerio.load(html);
const imgAssets = $('img');
// ... (135 more lines)
Domain
Dependencies
- cheerio
- loadFixture
- node:test
- strict
- test-adapter.js
- test-utils.js
Source
Frequently Asked Questions
What does astro-assets-prefix.test.js do?
astro-assets-prefix.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does astro-assets-prefix.test.js depend on?
astro-assets-prefix.test.js imports 6 module(s): cheerio, loadFixture, node:test, strict, test-adapter.js, test-utils.js.
Where is astro-assets-prefix.test.js in the architecture?
astro-assets-prefix.test.js is located at packages/astro/test/astro-assets-prefix.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