Home / File/ preview-routing.test.js — astro Source File

preview-routing.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  666509be_e157_1ed4_b20e_d8e72ead4d93["preview-routing.test.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  666509be_e157_1ed4_b20e_d8e72ead4d93 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  666509be_e157_1ed4_b20e_d8e72ead4d93 --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  666509be_e157_1ed4_b20e_d8e72ead4d93 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  666509be_e157_1ed4_b20e_d8e72ead4d93 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  666509be_e157_1ed4_b20e_d8e72ead4d93 --> deb87372_5629_35f8_9a54_e755a08f776a
  style 666509be_e157_1ed4_b20e_d8e72ead4d93 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

describe('Preview Routing', () => {
	describe('build format: directory', () => {
		describe('Subpath without trailing slash and trailingSlash: never', () => {
			/** @type {import('./test-utils').Fixture} */
			let fixture;
			/** @type {import('./test-utils').PreviewServer} */
			let previewServer;

			before(async () => {
				fixture = await loadFixture({
					root: './fixtures/with-subpath-no-trailing-slash/',
					base: '/blog',
					outDir: './dist-4000',
					build: {
						format: 'directory',
					},
					trailingSlash: 'never',
					server: {
						port: 4000,
					},
				});
				await fixture.build();
				previewServer = await fixture.preview();
			});

			after(async () => {
				await previewServer.stop();
			});

			it('404 when loading /', async () => {
				const response = await fixture.fetch('/');
				assert.equal(response.status, 404);
			});

			it('200 when loading subpath root with trailing slash', async () => {
				const response = await fixture.fetch('/blog/');
				assert.equal(response.status, 200);
				assert.equal(response.redirected, false);
			});

			it('200 when loading subpath root without trailing slash', async () => {
				const response = await fixture.fetch('/blog');
				assert.equal(response.status, 200);
				assert.equal(response.redirected, false);
			});

			it('404 when loading another page with subpath used', async () => {
				const response = await fixture.fetch('/blog/another/');
				assert.equal(response.status, 404);
			});

			it('200 when loading dynamic route', async () => {
				const response = await fixture.fetch('/blog/1');
				assert.equal(response.status, 200);
			});
// ... (380 more lines)

Dependencies

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free