Home / Function/ createFixture() — astro Function Reference

createFixture() — astro Function Reference

Architecture documentation for the createFixture() function in env-validators.test.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  23e82b6f_060b_7bda_2026_74128de90159["createFixture()"]
  bc34c11d_40c1_fec6_ef8f_84302d18dddd["env-validators.test.js"]
  23e82b6f_060b_7bda_2026_74128de90159 -->|defined in| bc34c11d_40c1_fec6_ef8f_84302d18dddd
  style 23e82b6f_060b_7bda_2026_74128de90159 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/units/env/env-validators.test.js lines 9–46

const createFixture = () => {
	/**
	 * @type {{ value: Params[1]; options: Params[2] }} input
	 */
	let input;

	return {
		/**
		 * @param {Params[1]} value
		 * @param {Params[2]} options
		 */
		givenInput(value, options) {
			input = { value, options };
		},
		/**
		 * @param {import("../../../src/env/validators.js").ValidationResultValue} value
		 */
		thenResultShouldBeValid(value) {
			const result = validateEnvVariable(input.value, input.options);
			assert.equal(result.ok, true);
			assert.equal(result.value, value);
			input = undefined;
		},
		/**
		 * @param {string | Array<string>} providedErrors
		 */
		thenResultShouldBeInvalid(providedErrors) {
			const result = validateEnvVariable(input.value, input.options);
			assert.equal(result.ok, false);
			const errors = typeof providedErrors === 'string' ? [providedErrors] : providedErrors;
			assert.equal(
				result.errors.every((element) => errors.includes(element)),
				true,
			);
			input = undefined;
		},
	};
};

Subdomains

Frequently Asked Questions

What does createFixture() do?
createFixture() is a function in the astro codebase, defined in packages/astro/test/units/env/env-validators.test.js.
Where is createFixture() defined?
createFixture() is defined in packages/astro/test/units/env/env-validators.test.js at line 9.

Analyze Your Own Codebase

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

Try Supermodel Free