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

astro_i18n.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  1fceb6fb_8614_6492_46c4_2ba0e77ae765["astro_i18n.test.js"]
  7df64f10_356e_5957_159a_70af8c9872ab["../../../dist/core/app/common.js"]
  1fceb6fb_8614_6492_46c4_2ba0e77ae765 --> 7df64f10_356e_5957_159a_70af8c9872ab
  ef38726d_6880_e84e_7900_90c0b06e793b["../../../dist/core/config/validate.js"]
  1fceb6fb_8614_6492_46c4_2ba0e77ae765 --> ef38726d_6880_e84e_7900_90c0b06e793b
  df111573_260e_3eeb_9fb9_0f4fdbd0f6af["../../../dist/core/errors/errors-data.js"]
  1fceb6fb_8614_6492_46c4_2ba0e77ae765 --> df111573_260e_3eeb_9fb9_0f4fdbd0f6af
  2e416dab_be5a_3320_ad78_477d5da20f4f["../../../dist/core/errors/index.js"]
  1fceb6fb_8614_6492_46c4_2ba0e77ae765 --> 2e416dab_be5a_3320_ad78_477d5da20f4f
  1a1ed578_b232_c6e5_267f_628bb695500b["../../../dist/i18n/index.js"]
  1fceb6fb_8614_6492_46c4_2ba0e77ae765 --> 1a1ed578_b232_c6e5_267f_628bb695500b
  12db2575_7d15_1686_b401_c5d8b71bdf31["../../../dist/i18n/utils.js"]
  1fceb6fb_8614_6492_46c4_2ba0e77ae765 --> 12db2575_7d15_1686_b401_c5d8b71bdf31
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  1fceb6fb_8614_6492_46c4_2ba0e77ae765 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  1fceb6fb_8614_6492_46c4_2ba0e77ae765 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  style 1fceb6fb_8614_6492_46c4_2ba0e77ae765 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { toRoutingStrategy } from '../../../dist/core/app/common.js';
import { validateConfig } from '../../../dist/core/config/validate.js';
import { MissingLocale } from '../../../dist/core/errors/errors-data.js';
import { AstroError } from '../../../dist/core/errors/index.js';
import {
	getLocaleAbsoluteUrl,
	getLocaleAbsoluteUrlList,
	getLocaleRelativeUrl,
	getLocaleRelativeUrlList,
} from '../../../dist/i18n/index.js';
import { parseLocale } from '../../../dist/i18n/utils.js';

describe('getLocaleRelativeUrl', () => {
	it('should correctly return the URL with the base', () => {
		/**
		 *
		 * @type {import("../../../dist/@types").AstroUserConfig}
		 */
		const config = {
			base: '/blog',
			experimental: {
				i18n: {
					defaultLocale: 'en',
					locales: [
						'en',
						'en_US',
						'es',
						{
							path: 'italiano',
							codes: ['it', 'it-VA'],
						},
					],
				},
			},
		};

		// directory format
		assert.equal(
			getLocaleRelativeUrl({
				locale: 'en',
				base: '/blog/',
				trailingSlash: 'always',
				format: 'directory',
				...config.experimental.i18n,
			}),
			'/blog/',
		);
		assert.equal(
			getLocaleRelativeUrl({
				locale: 'es',
				base: '/blog/',
				...config.experimental.i18n,
				trailingSlash: 'always',
				format: 'directory',
			}),
			'/blog/es/',
		);

// ... (1846 more lines)

Dependencies

  • ../../../dist/core/app/common.js
  • ../../../dist/core/config/validate.js
  • ../../../dist/core/errors/errors-data.js
  • ../../../dist/core/errors/index.js
  • ../../../dist/i18n/index.js
  • ../../../dist/i18n/utils.js
  • node:test
  • strict

Frequently Asked Questions

What does astro_i18n.test.js do?
astro_i18n.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does astro_i18n.test.js depend on?
astro_i18n.test.js imports 8 module(s): ../../../dist/core/app/common.js, ../../../dist/core/config/validate.js, ../../../dist/core/errors/errors-data.js, ../../../dist/core/errors/index.js, ../../../dist/i18n/index.js, ../../../dist/i18n/utils.js, node:test, strict.
Where is astro_i18n.test.js in the architecture?
astro_i18n.test.js is located at packages/astro/test/units/i18n/astro_i18n.test.js (domain: IntegrationAdapters, directory: packages/astro/test/units/i18n).

Analyze Your Own Codebase

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

Try Supermodel Free