astro-assets.test.js — astro Source File
Architecture documentation for astro-assets.test.js, a javascript file in the astro codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR f743b36d_d767_e14f_aeff_43d824412bdb["astro-assets.test.js"] 0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"] f743b36d_d767_e14f_aeff_43d824412bdb --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15 dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"] f743b36d_d767_e14f_aeff_43d824412bdb --> dd4f09ce_3fd7_8295_f616_8876cda4555c e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] f743b36d_d767_e14f_aeff_43d824412bdb --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] f743b36d_d767_e14f_aeff_43d824412bdb --> 6b0635f9_51ea_77aa_767b_7857878e98a6 deb87372_5629_35f8_9a54_e755a08f776a["cheerio"] f743b36d_d767_e14f_aeff_43d824412bdb --> deb87372_5629_35f8_9a54_e755a08f776a 9acfaf7d_d90a_d0bd_06fc_bc7e161d2a93["parse-srcset"] f743b36d_d767_e14f_aeff_43d824412bdb --> 9acfaf7d_d90a_d0bd_06fc_bc7e161d2a93 style f743b36d_d767_e14f_aeff_43d824412bdb 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 parseSrcset from 'parse-srcset';
import { loadFixture } from './test-utils.js';
// Asset bundling
describe('Assets', () => {
let fixture;
before(async () => {
fixture = await loadFixture({
root: './fixtures/astro-assets/',
});
await fixture.build();
});
it('built the base image', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
const imgPath = $('img').attr('src');
const data = await fixture.readFile(imgPath);
assert.equal(!!data, true);
});
it('built the 2x image', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
const srcset = $('img').attr('srcset');
const candidates = parseSrcset(srcset);
const match = candidates.find((a) => a.d === 2);
const data = await fixture.readFile(match.url);
assert.equal(!!data, true);
});
it('built the 3x image', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
const srcset = $('img').attr('srcset');
const candidates = parseSrcset(srcset);
const match = candidates.find((a) => a.d === 3);
const data = await fixture.readFile(match.url);
assert.equal(!!data, true);
});
it('built image from an import specifier', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
const src = $('#import-no-url').attr('src');
const data = await fixture.readFile(src);
assert.equal(!!data, true);
});
it('built image from an import specifier using ?url', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
const src = $('#import-url').attr('src');
const data = await fixture.readFile(src);
assert.equal(!!data, true);
});
});
Domain
Dependencies
- cheerio
- loadFixture
- node:test
- parse-srcset
- strict
- test-utils.js
Source
Frequently Asked Questions
What does astro-assets.test.js do?
astro-assets.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does astro-assets.test.js depend on?
astro-assets.test.js imports 6 module(s): cheerio, loadFixture, node:test, parse-srcset, strict, test-utils.js.
Where is astro-assets.test.js in the architecture?
astro-assets.test.js is located at packages/astro/test/astro-assets.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