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

staticPaths.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  72fba1ee_2f28_60d8_db46_b02629c45c47["staticPaths.test.js"]
  4b1e6526_afae_1cc3_9eb4_67fe4c476b26["test-utils.js"]
  72fba1ee_2f28_60d8_db46_b02629c45c47 --> 4b1e6526_afae_1cc3_9eb4_67fe4c476b26
  5ab044f2_ed09_99b6_2b30_c55f0f9a239c["loadFixture"]
  72fba1ee_2f28_60d8_db46_b02629c45c47 --> 5ab044f2_ed09_99b6_2b30_c55f0f9a239c
  b2ff3d1c_3baf_6707_d502_0f4b2a220a11["readXML"]
  72fba1ee_2f28_60d8_db46_b02629c45c47 --> b2ff3d1c_3baf_6707_d502_0f4b2a220a11
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  72fba1ee_2f28_60d8_db46_b02629c45c47 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  72fba1ee_2f28_60d8_db46_b02629c45c47 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  style 72fba1ee_2f28_60d8_db46_b02629c45c47 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('getStaticPaths support', () => {
	/** @type {import('./test-utils.js').Fixture} */
	let fixture;
	/** @type {string[]} */
	let urls;

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

		const data = await readXML(fixture.readFile('/sitemap-0.xml'));
		urls = data.urlset.url.map((url) => url.loc[0]);
	});

	it('requires zero config for getStaticPaths', async () => {
		assert.equal(urls.includes('http://example.com/one/'), true);
		assert.equal(urls.includes('http://example.com/two/'), true);
	});

	it('does not include 404 pages', () => {
		assert.equal(urls.includes('http://example.com/404/'), false);
	});

	it('does not include nested 404 pages', () => {
		assert.equal(urls.includes('http://example.com/de/404/'), false);
	});

	it('includes numerical pages', () => {
		assert.equal(urls.includes('http://example.com/123/'), true);
	});

	it('includes numerical 404 pages if not for i18n', () => {
		assert.equal(urls.includes('http://example.com/products-by-id/405/'), true);
		assert.equal(urls.includes('http://example.com/products-by-id/404/'), true);
	});

	it('should render the endpoint', async () => {
		const page = await fixture.readFile('./it/manifest');
		assert.match(page, /I'm a route in the "it" language./);
	});
});

Domain

Dependencies

Frequently Asked Questions

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