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

wrangler.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  fcc2b385_fe2e_2ff8_7085_4a08db61ae08["wrangler.test.js"]
  55e66d78_bb7e_b016_df6a_778814627a79["../dist/wrangler.js"]
  fcc2b385_fe2e_2ff8_7085_4a08db61ae08 --> 55e66d78_bb7e_b016_df6a_778814627a79
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  fcc2b385_fe2e_2ff8_7085_4a08db61ae08 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  fcc2b385_fe2e_2ff8_7085_4a08db61ae08 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  style fcc2b385_fe2e_2ff8_7085_4a08db61ae08 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import {
	cloudflareConfigCustomizer,
	DEFAULT_ASSETS_BINDING_NAME,
	DEFAULT_IMAGES_BINDING_NAME,
	DEFAULT_SESSION_KV_BINDING_NAME,
} from '../dist/wrangler.js';

describe('cloudflareConfigCustomizer', () => {
	describe('main entrypoint', () => {
		it('sets main to the server entrypoint when none exists', () => {
			const customizer = cloudflareConfigCustomizer();
			const result = customizer({});

			assert.equal(result.main, '@astrojs/cloudflare/entrypoints/server');
		});

		it('preserves user main entrypoint', () => {
			const customizer = cloudflareConfigCustomizer();
			const result = customizer({ main: './src/worker.ts' });

			assert.equal(result.main, './src/worker.ts');
		});
	});

	describe('session KV binding', () => {
		it('adds default SESSION KV binding when none exists', () => {
			const customizer = cloudflareConfigCustomizer();
			const result = customizer({});

			assert.deepEqual(result.kv_namespaces, [{ binding: DEFAULT_SESSION_KV_BINDING_NAME }]);
		});

		it('adds custom SESSION KV binding name when specified', () => {
			const customizer = cloudflareConfigCustomizer({ sessionKVBindingName: 'MY_SESSION' });
			const result = customizer({});

			assert.deepEqual(result.kv_namespaces, [{ binding: 'MY_SESSION' }]);
		});

		it('does not add SESSION binding when one already exists with default name', () => {
			const customizer = cloudflareConfigCustomizer();
			const result = customizer({
				kv_namespaces: [{ binding: DEFAULT_SESSION_KV_BINDING_NAME, id: 'existing-id' }],
			});

			assert.equal(result.kv_namespaces, undefined);
		});

		it('does not add SESSION binding when one already exists with custom name', () => {
			const customizer = cloudflareConfigCustomizer({ sessionKVBindingName: 'MY_SESSION' });
			const result = customizer({
				kv_namespaces: [{ binding: 'MY_SESSION', id: 'existing-id' }],
			});

			assert.equal(result.kv_namespaces, undefined);
		});

		it('adds SESSION binding when other KV bindings exist but not the session one', () => {
// ... (74 more lines)

Domain

Dependencies

  • ../dist/wrangler.js
  • node:test
  • strict

Frequently Asked Questions

What does wrangler.test.js do?
wrangler.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does wrangler.test.js depend on?
wrangler.test.js imports 3 module(s): ../dist/wrangler.js, node:test, strict.
Where is wrangler.test.js in the architecture?
wrangler.test.js is located at packages/integrations/cloudflare/test/wrangler.test.js (domain: CoreAstro, directory: packages/integrations/cloudflare/test).

Analyze Your Own Codebase

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

Try Supermodel Free