Home / File/ base-path.test.js — astro Source File

base-path.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  90d322f7_ad74_41a4_161e_81bac1e24726["base-path.test.js"]
  4b1e6526_afae_1cc3_9eb4_67fe4c476b26["test-utils.js"]
  90d322f7_ad74_41a4_161e_81bac1e24726 --> 4b1e6526_afae_1cc3_9eb4_67fe4c476b26
  5ab044f2_ed09_99b6_2b30_c55f0f9a239c["loadFixture"]
  90d322f7_ad74_41a4_161e_81bac1e24726 --> 5ab044f2_ed09_99b6_2b30_c55f0f9a239c
  b2ff3d1c_3baf_6707_d502_0f4b2a220a11["readXML"]
  90d322f7_ad74_41a4_161e_81bac1e24726 --> b2ff3d1c_3baf_6707_d502_0f4b2a220a11
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  90d322f7_ad74_41a4_161e_81bac1e24726 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  90d322f7_ad74_41a4_161e_81bac1e24726 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  style 90d322f7_ad74_41a4_161e_81bac1e24726 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import assert from 'node:assert/strict';
import { before, describe, it } from 'node:test';
import { loadFixture, readXML } from './test-utils.js';

describe('URLs with base path', () => {
	/** @type {import('./test-utils').Fixture} */
	let fixture;

	describe('using node adapter', () => {
		before(async () => {
			fixture = await loadFixture({
				root: './fixtures/ssr/',
				base: '/base',
			});
			await fixture.build();
		});

		it('Base path is concatenated correctly', async () => {
			const [sitemapZero, sitemapIndex] = await Promise.all([
				readXML(fixture.readFile('/client/sitemap-0.xml')),
				readXML(fixture.readFile('/client/sitemap-index.xml')),
			]);
			assert.equal(sitemapZero.urlset.url[0].loc[0], 'http://example.com/base/one/');
			assert.equal(
				sitemapIndex.sitemapindex.sitemap[0].loc[0],
				'http://example.com/base/sitemap-0.xml',
			);
		});
	});

	describe('static', () => {
		before(async () => {
			fixture = await loadFixture({
				root: './fixtures/static/',
				base: '/base',
			});
			await fixture.build();
		});

		it('Base path is concatenated correctly', async () => {
			const [sitemapZero, sitemapIndex] = await Promise.all([
				readXML(fixture.readFile('/sitemap-0.xml')),
				readXML(fixture.readFile('/sitemap-index.xml')),
			]);
			assert.equal(sitemapZero.urlset.url[0].loc[0], 'http://example.com/base/123/');
			assert.equal(
				sitemapIndex.sitemapindex.sitemap[0].loc[0],
				'http://example.com/base/sitemap-0.xml',
			);
		});
	});
});

Domain

Dependencies

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free