Home / File/ user-route-priority.test.js — astro Source File

user-route-priority.test.js — astro Source File

Architecture documentation for user-route-priority.test.js, a javascript file in the astro codebase. 6 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  f30e2d13_2b48_f9b7_8563_3c6cebad234b["user-route-priority.test.js"]
  be670a78_841c_46e5_0af5_c5c328869ecb["test-adapter.js"]
  f30e2d13_2b48_f9b7_8563_3c6cebad234b --> be670a78_841c_46e5_0af5_c5c328869ecb
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  f30e2d13_2b48_f9b7_8563_3c6cebad234b --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  f30e2d13_2b48_f9b7_8563_3c6cebad234b --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  f30e2d13_2b48_f9b7_8563_3c6cebad234b --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  f30e2d13_2b48_f9b7_8563_3c6cebad234b --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  f30e2d13_2b48_f9b7_8563_3c6cebad234b --> deb87372_5629_35f8_9a54_e755a08f776a
  style f30e2d13_2b48_f9b7_8563_3c6cebad234b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import assert from 'node:assert/strict';
import { before, describe, it } from 'node:test';
import { load as cheerioLoad } from 'cheerio';
import testAdapter from './test-adapter.js';
import { loadFixture } from './test-utils.js';

describe('User routes have priority over internal routes', () => {
	/** @type {import('./test-utils.js').Fixture} */
	let fixture;

	before(async () => {
		const root = './fixtures/user-route-priority/';
		fixture = await loadFixture({
			root,
			output: 'server',
			adapter: testAdapter(),
		});
		await fixture.build();
	});

	async function fetchHTML(path) {
		const app = await fixture.loadTestAdapterApp();
		const request = new Request('http://example.com' + path);
		const response = await app.render(request);
		const html = await response.text();
		return html;
	}

	it("Page doesn't error with non-404 as number", async () => {
		const html = await fetchHTML('/123');
		const $ = cheerioLoad(html);
		assert.equal($('h1').text(), '123');
	});

	it("Page doesn't error with 404 as number", async () => {
		const html = await fetchHTML('/404');
		const $ = cheerioLoad(html);
		assert.equal($('h1').text(), '404');
	});
});

Dependencies

Frequently Asked Questions

What does user-route-priority.test.js do?
user-route-priority.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does user-route-priority.test.js depend on?
user-route-priority.test.js imports 6 module(s): cheerio, loadFixture, node:test, strict, test-adapter.js, test-utils.js.
Where is user-route-priority.test.js in the architecture?
user-route-priority.test.js is located at packages/astro/test/user-route-priority.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