/** * Test Assertions * * Provides reusable assertion functions for AWS SDK error patterns * and common test scenarios. These helpers ensure consistent * validation across integration tests. * * Usage: * import { * assertIsRetriableError, * assertIsThrottlingError, * assertErrorMetadata * } from './utilities/test-assertions' * * it('should be retriable', () => { * assertIsRetriableError(error) * }) */ /** * Asserts that an error is retriable based on AWS SDK v3 patterns */ export declare function assertIsRetriableError(error: unknown): void; /** * Asserts that an error is NOT retriable */ export declare function assertIsNotRetriableError(error: unknown): void; /** * Asserts that an error is a throttling error */ export declare function assertIsThrottlingError(error: unknown): void; /** * Asserts that an error is a network error */ export declare function assertIsNetworkError(error: unknown): void; /** * Asserts that an error is a timeout error */ export declare function assertIsTimeoutError(error: unknown): void; /** * Asserts that an error has the expected metadata */ export declare function assertErrorMetadata(error: unknown, expected: { httpStatusCode?: number; requestId?: string; name?: string; fault?: 'client' | 'server'; }): void; /** * Asserts that an error has a valid request ID */ export declare function assertHasRequestId(error: unknown): void; /** * Asserts that an error is a client fault (4xx) */ export declare function assertIsClientFault(error: unknown): void; /** * Asserts that an error is a server fault (5xx) */ export declare function assertIsServerFault(error: unknown): void; /** * Asserts that a response has the expected structure */ export declare function assertResponseStructure(response: unknown, expectedKeys: Array): void; /** * Asserts that a DynamoDB response has valid metadata */ export declare function assertDynamoDBResponseMetadata(response: unknown): void; /** * Asserts that an async function throws an error with the expected name */ export declare function assertThrowsErrorWithName(fn: () => Promise, expectedName: string): Promise; /** * Asserts that an async function throws an error matching a predicate */ export declare function assertThrowsErrorMatching(fn: () => Promise, predicate: (error: unknown) => boolean, description?: string): Promise; /** * Asserts that an async operation completes within a time limit */ export declare function assertCompletesWithin(fn: () => Promise, timeoutMs: number): Promise; /** * Asserts that an async operation takes at least a minimum time * (useful for testing retry delays) */ export declare function assertTakesAtLeast(fn: () => Promise, minMs: number): Promise; /** * Forces garbage collection if available (requires --expose-gc flag) */ export declare function forceGC(): void; /** * Gets current heap memory usage in bytes */ export declare function getHeapUsed(): number; /** * Asserts that memory increase is within acceptable limits */ export declare function assertMemoryIncreaseLessThan(initialMemory: number, maxIncreaseBytes: number): void; /** * Runs a function and asserts memory usage stays within limits */ export declare function assertNoMemoryLeak(fn: () => Promise, maxIncreaseBytes?: number): Promise; /** * Asserts that an array has the expected length */ export declare function assertArrayLength(array: T[], expectedLength: number): void; /** * Asserts that all items in an array match a predicate */ export declare function assertAllMatch(array: T[], predicate: (item: T) => boolean, description?: string): void; /** * Asserts that an array contains unique items based on a key function */ export declare function assertUniqueBy(array: T[], keyFn: (item: T) => K): void;