import { type Constructor } from '../../types.js'; import { type BaseTestable } from '../support_testing/base_testable.js'; /** * Validation error keys type * Supports: string, string[], or Record */ export type ValidationErrorKeys = string | string[] | Record; /** * MessageBag-like structure for validation errors */ export declare class MessageBag { #private; constructor(errors?: Record); /** * Check if there are any errors */ isEmpty(): boolean; /** * Check if there are any errors */ isNotEmpty(): boolean; /** * Check if a key has errors */ has(key: string): boolean; /** * Get error messages for a key */ get(key: string): string[]; /** * Get all error keys */ keys(): string[]; /** * Get all messages as a record */ all(): Record; } /** * Provides validation assertion methods for testing components * Equivalent to PHP's TestsValidation trait */ export declare function TestsValidation>(Base: TConstructor): { new (...args: any[]): { /** * Get validation errors from component * Checks multiple sources: effects.errors, memo.errors, or component.getErrorBag() */ errors(): MessageBag; /** * Get failed validation rules */ failedRules(): Record; /** * Assert the component has validation errors * * @example * // Assert component has any errors * test.assertHasErrors() * * // Assert component has errors for specific keys * test.assertHasErrors('name') * test.assertHasErrors(['name', 'email']) * * // Assert component has errors for specific keys with specific rules * test.assertHasErrors({ name: 'required', email: ['required', 'email'] }) */ assertHasErrors(keys?: ValidationErrorKeys): /*elided*/ any; /** * Assert the component has no validation errors * * @example * // Assert component has no errors at all * test.assertHasNoErrors() * * // Assert component has no errors for specific keys * test.assertHasNoErrors('name') * test.assertHasNoErrors(['name', 'email']) * * // Assert component has no specific rule errors * test.assertHasNoErrors({ name: 'required' }) */ assertHasNoErrors(keys?: ValidationErrorKeys): /*elided*/ any; /** * Internal method to make an error assertion for a specific key */ "__#213@#makeErrorAssertion"(key: string, value?: string | string[]): void; /** * Assert that an error matches a specific rule or message */ "__#213@#assertErrorMatchesRuleOrMessage"(rules: string[], messages: string[], key: string, ruleOrMessage: string): void; /** * Convert string to snake_case */ "__#213@#toSnakeCase"(str: string): string; /** * Convert string to StudlyCase (PascalCase) */ "__#213@#toStudlyCase"(str: string): string; "__#218@#state": import("../support_testing/component_state.ts").ComponentState; "__#218@#dataStore": import("../../store.js").DataStore; "__#218@#componentContext": import("../../component_context.ts").default; "__#218@#app": import("@adonisjs/core/types").ApplicationService; "__#218@#ctx": import("@adonisjs/http-server").HttpContext; "__#218@#features": import("../../component_hook.ts").default[]; "__#218@#mountParams": any[]; readonly mountParams: any[]; readonly state: import("../support_testing/component_state.ts").ComponentState; mount(...params: any[]): import("../support_testing/base_testable.js").ChainableTest; set(propertyName: string, value: any): import("../support_testing/base_testable.js").ChainableTest; call(method: string, ...params: any[]): import("../support_testing/base_testable.js").ChainableTest; toggle(propertyName: string): import("../support_testing/base_testable.js").ChainableTest; refresh(): import("../support_testing/base_testable.js").ChainableTest; get(propertyName: string): any; snapshot(): import("../../types.js").ComponentSnapshot; effects(): import("../../types.js").ComponentEffects; html(): string; instance(): import("../../component.ts").Component; getState(): import("../support_testing/component_state.ts").ComponentState; "__#218@#executeMount"(...params: any[]): Promise; "__#218@#executeSet"(propertyName: string, value: any): Promise; "__#218@#executeCall"(method: string, ...params: any[]): Promise; "__#218@#executeToggle"(propertyName: string): Promise; "__#218@#executeRefresh"(): Promise; "__#218@#updateComponentState"(component: import("../../component.ts").Component, componentContext: import("../../component_context.ts").default): Promise; "__#218@#getComponentState"(component: import("../../component.ts").Component): Record; "__#218@#createFeatures"(component: import("../../component.ts").Component): import("../../component_hook.ts").default[]; hasMethod(obj: any, methodName: string): boolean; }; } & TConstructor; /** * Interface for type safety when using TestsValidation mixin */ export interface TestsValidation { errors(): MessageBag; failedRules(): Record; assertHasErrors(keys?: ValidationErrorKeys): this; assertHasNoErrors(keys?: ValidationErrorKeys): this; }