Home / File/ trailing-slash.test.js — astro Source File

trailing-slash.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  ba9ffc57_130c_e81f_a661_7b8bace7aae8["trailing-slash.test.js"]
  760b1776_8858_e3bd_06b8_5cc4c1a9cbdc["../dist/index.js"]
  ba9ffc57_130c_e81f_a661_7b8bace7aae8 --> 760b1776_8858_e3bd_06b8_5cc4c1a9cbdc
  ff334e41_2760_839e_fc38_ab9318c18dfc["test-utils.js"]
  ba9ffc57_130c_e81f_a661_7b8bace7aae8 --> ff334e41_2760_839e_fc38_ab9318c18dfc
  0b7a6b11_e910_da4b_c617_1880167f44ef["loadFixture"]
  ba9ffc57_130c_e81f_a661_7b8bace7aae8 --> 0b7a6b11_e910_da4b_c617_1880167f44ef
  0f98dbf7_3a77_7344_74c6_cb678c4a98d0["waitServerListen"]
  ba9ffc57_130c_e81f_a661_7b8bace7aae8 --> 0f98dbf7_3a77_7344_74c6_cb678c4a98d0
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  ba9ffc57_130c_e81f_a661_7b8bace7aae8 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  ba9ffc57_130c_e81f_a661_7b8bace7aae8 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  ba9ffc57_130c_e81f_a661_7b8bace7aae8 --> deb87372_5629_35f8_9a54_e755a08f776a
  style ba9ffc57_130c_e81f_a661_7b8bace7aae8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as assert from 'node:assert/strict';
import { after, before, describe, it } from 'node:test';
import * as cheerio from 'cheerio';
import nodejs from '../dist/index.js';
import { loadFixture, waitServerListen } from './test-utils.js';

/**
 * @typedef {import('../../../astro/test/test-utils').Fixture} Fixture
 */

describe('Trailing slash', () => {
	/** @type {import('./test-utils').Fixture} */
	let fixture;
	let server;
	describe('Always', async () => {
		describe('With base', async () => {
			before(async () => {
				process.env.ASTRO_NODE_AUTOSTART = 'disabled';
				process.env.PRERENDER = true;

				fixture = await loadFixture({
					root: './fixtures/trailing-slash/',
					base: '/some-base',
					output: 'static',
					trailingSlash: 'always',
					outDir: './dist/always-with-base',
					adapter: nodejs({ mode: 'standalone' }),
				});
				await fixture.build();
				const { startServer } = await fixture.loadAdapterEntryModule();
				const res = startServer();
				server = res.server;
				await waitServerListen(server.server);
			});

			after(async () => {
				await server.stop();
				await fixture.clean();

				delete process.env.PRERENDER;
			});

			it('Can render prerendered base route', async () => {
				const res = await fetch(`http://${server.host}:${server.port}`);
				const html = await res.text();
				const $ = cheerio.load(html);

				assert.equal(res.status, 200);
				assert.equal($('h1').text(), 'Index');
			});

			it('Can render prerendered route with redirect', async () => {
				const res = await fetch(`http://${server.host}:${server.port}/some-base/one`, {
					redirect: 'manual',
				});
				assert.equal(res.status, 301);
				assert.equal(res.headers.get('location'), '/some-base/one/');
			});

			it('Can render prerendered route with redirect and query params', async () => {
// ... (434 more lines)

Domain

Dependencies

Frequently Asked Questions

What does trailing-slash.test.js do?
trailing-slash.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does trailing-slash.test.js depend on?
trailing-slash.test.js imports 7 module(s): ../dist/index.js, cheerio, loadFixture, node:test, strict, test-utils.js, waitServerListen.
Where is trailing-slash.test.js in the architecture?
trailing-slash.test.js is located at packages/integrations/node/test/trailing-slash.test.js (domain: CoreAstro, directory: packages/integrations/node/test).

Analyze Your Own Codebase

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

Try Supermodel Free