import { IDomainEvent } from '../../../contracts/src/index.ts'; /** * Minimal interface for aggregates usable with GWT testing. * Avoids circular dependency on @vytches/ddd-aggregates. */ interface GWTAggregate { getDomainEvents(): ReadonlyArray; commit(): void; } /** * @public * @stable * @since 0.24.0 */ export interface GivenStep { given(...events: IDomainEvent[]): WhenStep; givenNothing(): WhenStep; } /** * @public * @stable * @since 0.24.0 */ export interface WhenStep { when(action: (aggregate: T) => void): ThenStep; whenAsync(action: (aggregate: T) => Promise): AsyncThenStep; } /** * @public * @stable * @since 0.24.0 */ export interface ThenStep { then(...expectedEvents: IDomainEvent[]): void; thenError(errorMessageOrCode: string): void; thenNothing(): void; } /** * @public * @stable * @since 0.24.0 */ export interface AsyncThenStep { then(...expectedEvents: IDomainEvent[]): Promise; thenError(errorMessageOrCode: string): Promise; thenNothing(): Promise; } /** * Entry point for GWT aggregate testing. * * @public * @stable * @since 0.24.0 * * @param aggregateFactory - Factory function that creates the aggregate under test * @returns A GivenStep to start the GWT chain * * @example * ```typescript * Test(() => new Order({ id: EntityId.create(), version: 0 })) * .given(new OrderCreated({ customerId: 'c1' })) * .when(order => order.place(items)) * .then(new OrderPlaced({ items })); * ``` */ export declare function Test(aggregateFactory: () => T): GivenStep; export {};