Home / File/ remark-imgattr.test.js — astro Source File

remark-imgattr.test.js — astro Source File

Architecture documentation for remark-imgattr.test.js, a javascript file in the astro codebase. 5 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  a333c2a7_e560_c502_c9dc_0dcbc7cadee3["remark-imgattr.test.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  a333c2a7_e560_c502_c9dc_0dcbc7cadee3 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  a333c2a7_e560_c502_c9dc_0dcbc7cadee3 --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  a333c2a7_e560_c502_c9dc_0dcbc7cadee3 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  a333c2a7_e560_c502_c9dc_0dcbc7cadee3 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  a333c2a7_e560_c502_c9dc_0dcbc7cadee3 --> deb87372_5629_35f8_9a54_e755a08f776a
  style a333c2a7_e560_c502_c9dc_0dcbc7cadee3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as assert from 'node:assert/strict';
import { after, before, describe, it } from 'node:test';
import * as cheerio from 'cheerio';
import { loadFixture } from '../../../astro/test/test-utils.js';

const FIXTURE_ROOT = new URL('./fixtures/image-remark-imgattr/', import.meta.url);

describe('Testing remark plugins for image processing', () => {
	/** @type {import('../../../astro/test/test-utils.js').Fixture} */
	let fixture;

	describe('start dev server', () => {
		/** @type {import('../../../astro/test/test-utils.js').DevServer} */
		let devServer;

		before(async () => {
			fixture = await loadFixture({
				root: FIXTURE_ROOT,
			});

			devServer = await fixture.startDevServer();
		});

		after(async () => {
			await devServer.stop();
		});

		describe('Test image attributes can be added by remark plugins', () => {
			let $;
			before(async () => {
				let res = await fixture.fetch('/');
				let html = await res.text();
				$ = cheerio.load(html);
			});

			it('<img> has correct attributes', async () => {
				let $img = $('img');
				assert.equal($img.attr('id'), 'test');
				assert.equal($img.attr('sizes'), '(min-width: 600px) 600w, 300w');
				assert.ok($img.attr('srcset'));
			});

			it('<img> was processed properly', async () => {
				let $img = $('img');
				assert.equal(new URL($img.attr('src'), 'http://example.com').searchParams.get('w'), '300');
			});
		});
	});
});

Domain

Dependencies

Frequently Asked Questions

What does remark-imgattr.test.js do?
remark-imgattr.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does remark-imgattr.test.js depend on?
remark-imgattr.test.js imports 5 module(s): cheerio, loadFixture, node:test, strict, test-utils.js.
Where is remark-imgattr.test.js in the architecture?
remark-imgattr.test.js is located at packages/integrations/mdx/test/remark-imgattr.test.js (domain: CoreAstro, directory: packages/integrations/mdx/test).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free