import { type Constructor } from '../../types.js'; import { type BaseTestable } from '../support_testing/base_testable.js'; /** * Dispatched event structure */ export interface DispatchedEvent { name: string; params: Record; to?: string; self?: boolean; } /** * Provides event assertion methods for testing components * Equivalent to PHP's TestsEvents trait */ export declare function TestsEvents>(Base: TConstructor): { new (...args: any[]): { /** * Dispatch an event to the component * * @param event - The event name to dispatch * @param params - Parameters to pass to the event handler * * @example * test.dispatch('userCreated', { id: 1 }) */ dispatch(event: string, ...params: any[]): /*elided*/ any; /** * Alias for dispatch * @deprecated Use dispatch instead */ fireEvent(event: string, ...params: any[]): /*elided*/ any; /** * Assert that an event was dispatched * * @param event - The event name to check * @param params - Optional parameters or callback to verify * * @example * // Assert event was dispatched * test.assertDispatched('userCreated') * * // Assert event was dispatched with specific parameters * test.assertDispatched('userCreated', { id: 1 }) * * // Assert event with callback verification * test.assertDispatched('userCreated', (name, params) => params.id === 1) */ assertDispatched(event: string, ...params: any[] | [(name: string, params: Record) => boolean]): /*elided*/ any; /** * Assert that an event was NOT dispatched * * @param event - The event name to check * @param params - Optional parameters to verify * * @example * test.assertNotDispatched('userDeleted') * test.assertNotDispatched('userCreated', { id: 1 }) */ assertNotDispatched(event: string, ...params: any[] | [(name: string, params: Record) => boolean]): /*elided*/ any; /** * Assert that an event was dispatched to a specific component * * @param target - The target component name or class * @param event - The event name * @param params - Optional parameters to verify * * @example * test.assertDispatchedTo('user-list', 'refresh') * test.assertDispatchedTo(UserList, 'userCreated', { id: 1 }) */ assertDispatchedTo(target: string | Function, event: string, ...params: any[]): /*elided*/ any; /** * Assert that an event was broadcasted to Transmit (SSE) channel * * @param channel - The Transmit channel name * @param eventName - Optional event name * * @example * test.assertBroadcastedToTransmit('orders/42', 'OrderShipped') */ assertBroadcastedToTransmit(channel: string, eventName?: string): /*elided*/ any; /** * Get all dispatched events from effects */ "__#216@#getDispatchedEvents"(): DispatchedEvent[]; /** * Test if an event was dispatched with optional parameter matching */ "__#216@#testDispatched"(event: string, params: any[]): { test: boolean; assertionSuffix: string; }; /** * Test if an event was dispatched to a specific component */ "__#216@#testDispatchedTo"(target: string | Function, event: string): boolean; /** * Resolve component name from class */ "__#216@#resolveComponentName"(target: Function): string; /** * Deep equality check */ "__#216@#isEqual"(a: any, b: any): boolean; "__#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 TestsEvents mixin */ export interface TestsEvents { dispatch(event: string, ...params: any[]): this; fireEvent(event: string, ...params: any[]): this; assertDispatched(event: string, ...params: any[] | [(name: string, params: Record) => boolean]): this; assertNotDispatched(event: string, ...params: any[] | [(name: string, params: Record) => boolean]): this; assertDispatchedTo(target: string | Function, event: string, ...params: any[]): this; assertBroadcastedToTransmit(channel: string, eventName?: string): this; }