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

namespaces.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  8e21d0d5_ba01_eb23_5d25_b50f91f41f44["namespaces.test.js"]
  3e0bb597_9e66_530b_95f2_ac6ee9bd2ce9["deps.mjs"]
  8e21d0d5_ba01_eb23_5d25_b50f91f41f44 --> 3e0bb597_9e66_530b_95f2_ac6ee9bd2ce9
  4b1e6526_afae_1cc3_9eb4_67fe4c476b26["test-utils.js"]
  8e21d0d5_ba01_eb23_5d25_b50f91f41f44 --> 4b1e6526_afae_1cc3_9eb4_67fe4c476b26
  5ab044f2_ed09_99b6_2b30_c55f0f9a239c["loadFixture"]
  8e21d0d5_ba01_eb23_5d25_b50f91f41f44 --> 5ab044f2_ed09_99b6_2b30_c55f0f9a239c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  8e21d0d5_ba01_eb23_5d25_b50f91f41f44 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  8e21d0d5_ba01_eb23_5d25_b50f91f41f44 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  style 8e21d0d5_ba01_eb23_5d25_b50f91f41f44 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import assert from 'node:assert/strict';
import { before, describe, it } from 'node:test';
import { sitemap } from './fixtures/static/deps.mjs';
import { loadFixture } from './test-utils.js';

describe('Namespaces Configuration', () => {
	let fixture;

	describe('Default namespaces', () => {
		before(async () => {
			fixture = await loadFixture({
				root: './fixtures/static/',
				integrations: [sitemap()],
			});
			await fixture.build();
		});

		it('includes all default namespaces', async () => {
			const xml = await fixture.readFile('/sitemap-0.xml');
			assert.ok(xml.includes('xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"'));
			assert.ok(xml.includes('xmlns:xhtml="http://www.w3.org/1999/xhtml"'));
			assert.ok(xml.includes('xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"'));
			assert.ok(xml.includes('xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"'));
		});
	});

	describe('Excluding news namespace', () => {
		before(async () => {
			fixture = await loadFixture({
				root: './fixtures/static/',
				integrations: [
					sitemap({
						namespaces: {
							news: false,
						},
					}),
				],
			});
			await fixture.build();
		});

		it('excludes news namespace but includes others', async () => {
			const xml = await fixture.readFile('/sitemap-0.xml');
			assert.ok(!xml.includes('xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"'));
			assert.ok(xml.includes('xmlns:xhtml="http://www.w3.org/1999/xhtml"'));
			assert.ok(xml.includes('xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"'));
			assert.ok(xml.includes('xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"'));
		});
	});

	describe('Minimal namespaces', () => {
		before(async () => {
			fixture = await loadFixture({
				root: './fixtures/static/',
				integrations: [
					sitemap({
						namespaces: {
							news: false,
							xhtml: false,
							image: false,
							video: false,
						},
					}),
				],
			});
			await fixture.build();
		});

		it('excludes all optional namespaces', async () => {
			const xml = await fixture.readFile('/sitemap-0.xml');
			assert.ok(!xml.includes('xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"'));
			assert.ok(!xml.includes('xmlns:xhtml="http://www.w3.org/1999/xhtml"'));
			assert.ok(!xml.includes('xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"'));
			assert.ok(!xml.includes('xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"'));
			// Still includes the main sitemap namespace
			assert.ok(xml.includes('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"'));
		});
	});
});

Domain

Dependencies

Frequently Asked Questions

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