Home / File/ manifest.test.js — astro Source File

manifest.test.js — astro Source File

Architecture documentation for manifest.test.js, a javascript file in the astro codebase. 7 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  448a9a48_23e5_03c6_511e_437b2e8b7eda["manifest.test.js"]
  f5b154b4_7bf2_7c8f_2105_5c84d2420bd1["../../dist/core/logger/core.js"]
  448a9a48_23e5_03c6_511e_437b2e8b7eda --> f5b154b4_7bf2_7c8f_2105_5c84d2420bd1
  1de385a4_d770_dcd5_6f76_8226740c4821["../../../dist/core/routing/manifest/create.js"]
  448a9a48_23e5_03c6_511e_437b2e8b7eda --> 1de385a4_d770_dcd5_6f76_8226740c4821
  b0be4d0c_86b6_a283_f2af_003189bfd572["test-utils.js"]
  448a9a48_23e5_03c6_511e_437b2e8b7eda --> b0be4d0c_86b6_a283_f2af_003189bfd572
  16e9d20a_70fc_8349_984c_4af9e0b840d5["createBasicSettings"]
  448a9a48_23e5_03c6_511e_437b2e8b7eda --> 16e9d20a_70fc_8349_984c_4af9e0b840d5
  f0937d94_cf30_e0fa_fbd5_135f8c876f70["createFixture"]
  448a9a48_23e5_03c6_511e_437b2e8b7eda --> f0937d94_cf30_e0fa_fbd5_135f8c876f70
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  448a9a48_23e5_03c6_511e_437b2e8b7eda --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  448a9a48_23e5_03c6_511e_437b2e8b7eda --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  style 448a9a48_23e5_03c6_511e_437b2e8b7eda fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { Logger } from '../../../dist/core/logger/core.js';
import { createRoutesList } from '../../../dist/core/routing/manifest/create.js';
import { createBasicSettings, createFixture } from '../test-utils.js';

function getManifestRoutes(manifest) {
	return manifest.routes.map((route) => ({
		type: route.type,
		route: route.route,
	}));
}

function getLogger() {
	const logs = [];

	return {
		logger: new Logger({
			dest: { write: (msg) => logs.push(msg) },
			level: 'debug',
		}),
		logs,
	};
}

function assertRouteRelations(routes, relations) {
	const routePaths = routes.map((route) => route.route);

	for (const [before, after] of relations) {
		const beforeIndex = routePaths.indexOf(before);
		const afterIndex = routePaths.indexOf(after);

		if (beforeIndex > afterIndex) {
			assert.fail(`${before} should be higher priority than ${after}`);
		}
	}
}

describe('routing - createRoutesList', () => {
	it('using trailingSlash: "never" does not match the index route when it contains a trailing slash', async () => {
		const fixture = await createFixture({
			'/src/pages/index.astro': `<h1>test</h1>`,
		});
		const settings = await createBasicSettings({
			root: fixture.path,
			base: '/search',
			trailingSlash: 'never',
		});
		const manifest = await createRoutesList({
			cwd: fixture.path,
			settings,
		});
		const [{ pattern }] = manifest.routes;
		assert.equal(pattern.test(''), true);
		assert.equal(pattern.test('/'), false);
	});

	it('endpoint routes are sorted before page routes', async () => {
		const fixture = await createFixture({
			'/src/pages/[contact].astro': `<h1>test</h1>`,
// ... (400 more lines)

Subdomains

Dependencies

Frequently Asked Questions

What does manifest.test.js do?
manifest.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain, SsrAdapters subdomain.
What functions are defined in manifest.test.js?
manifest.test.js defines 3 function(s): assertRouteRelations, getLogger, getManifestRoutes.
What does manifest.test.js depend on?
manifest.test.js imports 7 module(s): ../../../dist/core/routing/manifest/create.js, ../../dist/core/logger/core.js, createBasicSettings, createFixture, node:test, strict, test-utils.js.
Where is manifest.test.js in the architecture?
manifest.test.js is located at packages/astro/test/units/routing/manifest.test.js (domain: IntegrationAdapters, subdomain: SsrAdapters, directory: packages/astro/test/units/routing).

Analyze Your Own Codebase

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

Try Supermodel Free