/** * Test Spec Validation * * Validates test specifications using Zod schemas. * Provides detailed error messages with field paths for easy debugging. */ import type { TestSpec, SuiteConfig, SuiteSpec } from "@wavespec/types"; /** * Validation result * * Indicates whether validation passed and provides detailed error messages. */ export interface ValidationResult { /** Whether validation passed */ valid: boolean; /** Validation error messages with field paths (if any) */ errors: string[]; } /** * Validate test specification * * Validates that an object conforms to the TestSpec schema. * Checks all required fields, validates types, and ensures constraints are met. * * @param spec - The object to validate as a TestSpec * @returns Validation result with detailed error messages * * @example * ```typescript * const result = validateTestSpec({ * name: "Test API call", * operation: "call", * params: { target: "echo" }, * assertions: [{ type: "success" }] * }); * * if (!result.valid) { * console.error("Test spec validation failed:"); * result.errors.forEach(err => console.error(` - ${err}`)); * } * ``` */ export declare function validateTestSpec(spec: unknown): ValidationResult; /** * Validate suite configuration * * Validates that an object conforms to the SuiteConfig schema. * Checks suite name, tests array, and all configuration options. * * @param config - The object to validate as a SuiteConfig * @returns Validation result with detailed error messages * * @example * ```typescript * const result = validateSuiteConfig({ * name: "API Test Suite", * tests: [ * { name: "Test 1", operation: "call", params: {}, assertions: [] } * ] * }); * * if (!result.valid) { * console.error("Suite config validation failed:"); * result.errors.forEach(err => console.error(` - ${err}`)); * } * ``` */ export declare function validateSuiteConfig(config: unknown): ValidationResult; /** * Validate suite specification * * Validates that an object conforms to the SuiteSpec schema (top-level YAML/JSON format). * Checks version and suite configuration. * * @param spec - The object to validate as a SuiteSpec * @returns Validation result with detailed error messages * * @example * ```typescript * const result = validateSuiteSpec({ * version: "1.0", * suite: { * name: "My Test Suite", * tests: [] * } * }); * * if (!result.valid) { * console.error("Suite spec validation failed:"); * result.errors.forEach(err => console.error(` - ${err}`)); * } * ``` */ export declare function validateSuiteSpec(spec: unknown): ValidationResult; /** * Type guard for TestSpec * * Checks if an object is a valid TestSpec at runtime. * * @param spec - The object to check * @returns True if the object is a valid TestSpec * * @example * ```typescript * if (isValidTestSpec(obj)) { * // TypeScript now knows obj is a TestSpec * console.log(obj.name); * } * ``` */ export declare function isValidTestSpec(spec: unknown): spec is TestSpec; /** * Type guard for SuiteConfig * * Checks if an object is a valid SuiteConfig at runtime. * * @param config - The object to check * @returns True if the object is a valid SuiteConfig * * @example * ```typescript * if (isValidSuiteConfig(obj)) { * // TypeScript now knows obj is a SuiteConfig * console.log(obj.name); * } * ``` */ export declare function isValidSuiteConfig(config: unknown): config is SuiteConfig; /** * Type guard for SuiteSpec * * Checks if an object is a valid SuiteSpec at runtime. * * @param spec - The object to check * @returns True if the object is a valid SuiteSpec * * @example * ```typescript * if (isValidSuiteSpec(obj)) { * // TypeScript now knows obj is a SuiteSpec * console.log(obj.version); * } * ``` */ export declare function isValidSuiteSpec(spec: unknown): spec is SuiteSpec; //# sourceMappingURL=test-spec.d.ts.map