core-image-unconventional-settings.test.js — astro Source File
Architecture documentation for core-image-unconventional-settings.test.js, a javascript file in the astro codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 2bfca8c7_ebd3_58e6_a5f6_0b15c5ba5b87["core-image-unconventional-settings.test.js"] c7ffa4ce_010c_7ea5_dae5_5dbecd5ec1ca["test-image-service.js"] 2bfca8c7_ebd3_58e6_a5f6_0b15c5ba5b87 --> c7ffa4ce_010c_7ea5_dae5_5dbecd5ec1ca fb1cb1ea_03bd_c4c5_f29a_ff1b9c6499cd["testImageService"] 2bfca8c7_ebd3_58e6_a5f6_0b15c5ba5b87 --> fb1cb1ea_03bd_c4c5_f29a_ff1b9c6499cd 0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"] 2bfca8c7_ebd3_58e6_a5f6_0b15c5ba5b87 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15 dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"] 2bfca8c7_ebd3_58e6_a5f6_0b15c5ba5b87 --> dd4f09ce_3fd7_8295_f616_8876cda4555c e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] 2bfca8c7_ebd3_58e6_a5f6_0b15c5ba5b87 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] 2bfca8c7_ebd3_58e6_a5f6_0b15c5ba5b87 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 deb87372_5629_35f8_9a54_e755a08f776a["cheerio"] 2bfca8c7_ebd3_58e6_a5f6_0b15c5ba5b87 --> deb87372_5629_35f8_9a54_e755a08f776a style 2bfca8c7_ebd3_58e6_a5f6_0b15c5ba5b87 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import * as cheerio from 'cheerio';
import { testImageService } from './test-image-service.js';
import { loadFixture } from './test-utils.js';
/**
** @typedef {import('../src/types/public/config.js').AstroInlineConfig & { root?: string | URL }} AstroInlineConfig
*/
/** @type {AstroInlineConfig} */
const defaultSettings = {
root: './fixtures/core-image-unconventional-settings/',
image: {
service: testImageService(),
},
};
describe('astro:assets - Support unconventional build settings properly', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
it('supports assetsPrefix', async () => {
fixture = await loadFixture({
...defaultSettings,
build: {
assetsPrefix: 'https://cdn.example.com/',
},
});
await fixture.build();
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
const src = $('#walrus-img').attr('src');
assert.equal(src.startsWith('https://cdn.example.com/'), true);
const data = await fixture.readFile(src.replace('https://cdn.example.com/', ''), null);
assert.equal(data instanceof Buffer, true);
});
it('supports base', async () => {
fixture = await loadFixture({
...defaultSettings,
build: {
base: '/subdir/',
},
});
await fixture.build();
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
const src = $('#walrus-img').attr('src');
const data = await fixture.readFile(src.replace('/subdir/', ''), null);
assert.equal(data instanceof Buffer, true);
});
// This test is a bit of a stretch, but it's a good sanity check, `assetsPrefix` should take precedence over `base` in this context
it('supports assetsPrefix + base', async () => {
fixture = await loadFixture({
// ... (147 more lines)
Domain
Dependencies
- cheerio
- loadFixture
- node:test
- strict
- test-image-service.js
- test-utils.js
- testImageService
Source
Frequently Asked Questions
What does core-image-unconventional-settings.test.js do?
core-image-unconventional-settings.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does core-image-unconventional-settings.test.js depend on?
core-image-unconventional-settings.test.js imports 7 module(s): cheerio, loadFixture, node:test, strict, test-image-service.js, test-utils.js, testImageService.
Where is core-image-unconventional-settings.test.js in the architecture?
core-image-unconventional-settings.test.js is located at packages/astro/test/core-image-unconventional-settings.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