@plyaz/types 1.3.2 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/api/index.d.ts +1 -0
  2. package/dist/api/types.d.ts +84 -0
  3. package/dist/auth/enums.d.ts +32 -0
  4. package/dist/auth/index.d.ts +3 -0
  5. package/dist/auth/schemas.d.ts +27 -0
  6. package/dist/auth/types.d.ts +34 -0
  7. package/dist/common/index.d.ts +1 -0
  8. package/dist/common/types.d.ts +22 -0
  9. package/dist/entities/index.d.ts +1 -0
  10. package/dist/errors/enums.d.ts +33 -0
  11. package/dist/errors/index.d.ts +2 -0
  12. package/dist/errors/types.d.ts +79 -0
  13. package/dist/events/enums.d.ts +25 -0
  14. package/dist/events/index.d.ts +3 -0
  15. package/dist/events/payload.d.ts +6 -0
  16. package/dist/events/types.d.ts +136 -0
  17. package/dist/features/cache/index.d.ts +1 -0
  18. package/dist/features/cache/types.d.ts +142 -0
  19. package/dist/features/feature-flag/index.d.ts +1 -0
  20. package/dist/features/feature-flag/types.d.ts +491 -0
  21. package/dist/features/index.d.ts +2 -0
  22. package/dist/index.d.ts +13 -0
  23. package/dist/store/index.d.ts +1 -0
  24. package/dist/testing/common/assertions/index.d.ts +1 -0
  25. package/dist/testing/common/assertions/types.d.ts +137 -0
  26. package/dist/testing/common/factories/index.d.ts +1 -0
  27. package/dist/testing/common/factories/types.d.ts +701 -0
  28. package/dist/testing/common/index.d.ts +6 -0
  29. package/dist/testing/common/mocks/index.d.ts +1 -0
  30. package/dist/testing/common/mocks/types.d.ts +1662 -0
  31. package/dist/testing/common/patterns/index.d.ts +1 -0
  32. package/dist/testing/common/patterns/types.d.ts +397 -0
  33. package/dist/testing/common/utils/index.d.ts +1 -0
  34. package/dist/testing/common/utils/types.d.ts +1970 -0
  35. package/dist/testing/common/wrappers/index.d.ts +1 -0
  36. package/dist/testing/common/wrappers/types.d.ts +373 -0
  37. package/dist/testing/features/cache/index.d.ts +1 -0
  38. package/dist/testing/features/cache/types.d.ts +43 -0
  39. package/dist/testing/features/feature-flags/index.d.ts +1 -0
  40. package/dist/testing/features/feature-flags/types.d.ts +1133 -0
  41. package/dist/testing/features/index.d.ts +2 -0
  42. package/dist/testing/index.d.ts +2 -0
  43. package/dist/translations/index.d.ts +1 -0
  44. package/dist/translations/types.d.ts +390 -0
  45. package/dist/ui/index.d.ts +1 -0
  46. package/dist/web3/enums.d.ts +17 -0
  47. package/dist/web3/index.d.ts +2 -0
  48. package/dist/web3/types.d.ts +63 -0
  49. package/package.json +5 -3
@@ -0,0 +1,1970 @@
1
+ /**
2
+ * @fileoverview Testing Utility Types
3
+ *
4
+ * Comprehensive type definitions for testing utilities across React, Next.js,
5
+ * NestJS, and general testing scenarios. Provides type safety and IntelliSense
6
+ * support for all testing patterns and utilities.
7
+ *
8
+ * This module includes types for:
9
+ * - React testing (components, hooks, providers)
10
+ * - Next.js testing (pages, API routes, middleware, SSR/SSG)
11
+ * - NestJS testing (controllers, services, modules)
12
+ * - Performance testing and measurement
13
+ * - Async testing utilities
14
+ * - Mock and spy configurations
15
+ * - Environment and configuration testing
16
+ * - Accessibility testing
17
+ * - Animation and timing testing
18
+ * - WebSocket and network testing
19
+ * - Memory and resource management
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * import type {
24
+ * NextPageTestOptions,
25
+ * ServiceTestHarnessOptions,
26
+ * ApiRouteTestContext,
27
+ * PerformanceMetrics
28
+ * } from './types';
29
+ *
30
+ * // Type-safe Next.js page testing
31
+ * const pageOptions: NextPageTestOptions = {
32
+ * router: { pathname: '/test' },
33
+ * mockModules: ['router', 'image']
34
+ * };
35
+ *
36
+ * // Type-safe NestJS service testing
37
+ * const serviceOptions: ServiceTestHarnessOptions<UserService> = {
38
+ * Service: UserService,
39
+ * dependencies: [
40
+ * { token: 'UserRepository', value: mockRepository }
41
+ * ]
42
+ * };
43
+ * ```
44
+ *
45
+ * @module TestingUtilityTypes
46
+ * @since 1.0.0
47
+ */
48
+ import type * as Vitest from 'vitest';
49
+ import type * as React from 'react';
50
+ import type { NextApiRequest as NextJSApiRequest, NextApiResponse as NextJSApiResponse, GetStaticPathsResult as NextGetStaticPathsResult } from 'next';
51
+ import type { Provider, Type } from '@nestjs/common';
52
+ import type { RenderOptions as RTLRenderOptions, RenderHookOptions as RTLRenderHookOptions } from '@testing-library/react';
53
+ import type { UserEvent as UserEventLib } from '@testing-library/user-event';
54
+ import type { MockEventEmitter, MockNextRouter, MockGetServerSidePropsContext, MockGetStaticPropsContext, MockNextApiResponse, MockNextApiRequest, TestScenario, CreateMockUseRouterReturn, CreateMockWebSocketReturn, CreateMockNextRequestFunction } from '..';
55
+ import type { UnknownRecord } from 'type-fest';
56
+ /**
57
+ * Subscription information for tracking subscriptions in tests
58
+ *
59
+ * @typeParam T - Type of data passed to subscription callbacks
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * const info: SubscriptionInfo<UserEvent> = {
64
+ * id: 'user-events-123',
65
+ * callback: vi.fn((event) => console.log(event)),
66
+ * unsubscribe: () => emitter.off('user', callback)
67
+ * };
68
+ * ```
69
+ */
70
+ export interface SubscriptionInfo<T = unknown> {
71
+ /** Unique identifier for the subscription */
72
+ id: string;
73
+ /** Mocked callback function that receives subscription data */
74
+ callback: Vitest.MockedFunction<(data: T) => void>;
75
+ /** Function to unsubscribe from the event */
76
+ unsubscribe: () => void;
77
+ }
78
+ /**
79
+ * Generic subscription tracker interface for managing event subscriptions in tests
80
+ *
81
+ * @typeParam T - Type of data passed to subscription callbacks
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * const tracker: SubscriptionTracker<MessageEvent> = createSubscriptionTracker();
86
+ *
87
+ * // Track a subscription
88
+ * const sub = tracker.track(
89
+ * (callback) => websocket.on('message', callback),
90
+ * 'ws-messages'
91
+ * );
92
+ *
93
+ * // Check subscription activity
94
+ * expect(tracker.getCallCount('ws-messages')).toBe(3);
95
+ * expect(tracker.getLastCall('ws-messages')).toEqual({ type: 'chat', text: 'Hello' });
96
+ *
97
+ * // Clean up
98
+ * tracker.unsubscribe('ws-messages');
99
+ * ```
100
+ */
101
+ export interface SubscriptionTracker<T = unknown> {
102
+ /** Track a new subscription with optional ID */
103
+ track: (subscribeFn: (callback: (data: T) => void) => () => void, id?: string) => SubscriptionInfo<T>;
104
+ /** Unsubscribe a specific subscription by ID */
105
+ unsubscribe: (id: string) => void;
106
+ /** Unsubscribe all tracked subscriptions */
107
+ unsubscribeAll: () => void;
108
+ /** Get the number of times a subscription callback was called */
109
+ getCallCount: (id: string) => number;
110
+ /** Get the data from the last callback invocation */
111
+ getLastCall: (id: string) => T | null;
112
+ /** Get all data from all callback invocations */
113
+ getAllCalls: (id: string) => T[];
114
+ /** Reset all subscriptions and their call history */
115
+ reset: () => void;
116
+ /** Reset only the callback history, keeping subscriptions active */
117
+ resetCallbacks: () => void;
118
+ /** Get list of active subscription IDs */
119
+ getActiveSubscriptions: () => string[];
120
+ /** Check if a subscription is currently active */
121
+ hasSubscription: (id: string) => boolean;
122
+ }
123
+ /**
124
+ * Return type for createTrackedEventEmitter function
125
+ *
126
+ * @typeParam T - Type of data emitted by events
127
+ *
128
+ * @example
129
+ * ```typescript
130
+ * const emitter: CreateTrackedEventEmitterReturn<{ userId: string; action: string }> = createTrackedEventEmitter();
131
+ *
132
+ * // Subscribe to events
133
+ * const unsubscribe = emitter.on('user-action', (data) => {
134
+ * console.log(`User ${data.userId} performed ${data.action}`);
135
+ * });
136
+ *
137
+ * // Emit events
138
+ * emitter.emit('user-action', { userId: '123', action: 'login' });
139
+ *
140
+ * // Check tracked events
141
+ * expect(emitter.tracker.getCallCount('default')).toBe(1);
142
+ * ```
143
+ */
144
+ export interface CreateTrackedEventEmitterReturn<T> {
145
+ /** Subscribe to an event with a callback, returns unsubscribe function */
146
+ on: (event: string, callback: (data: T) => void) => () => void;
147
+ /** Emit an event with data to all listeners */
148
+ emit: (event: string, data: T) => void;
149
+ /** Remove all listeners for a specific event or all events */
150
+ removeAllListeners: (event?: string) => void;
151
+ /** Subscription tracker for monitoring event activity */
152
+ tracker: SubscriptionTracker<T>;
153
+ }
154
+ /**
155
+ * Deferred promise for controlling async flow in tests
156
+ *
157
+ * @typeParam T - Type of the resolved value
158
+ *
159
+ * @example
160
+ * ```typescript
161
+ * const deferred: DeferredPromise<User> = createDeferredPromise();
162
+ *
163
+ * // Start async operation
164
+ * const userPromise = fetchUser().then(user => {
165
+ * deferred.resolve(user);
166
+ * return user;
167
+ * });
168
+ *
169
+ * // Control when promise resolves
170
+ * expect(deferred.isPending).toBe(true);
171
+ * deferred.resolve({ id: 1, name: 'Test User' });
172
+ *
173
+ * const user = await deferred.promise;
174
+ * expect(deferred.isResolved).toBe(true);
175
+ * ```
176
+ */
177
+ export interface DeferredPromise<T = void> {
178
+ /** The promise that can be awaited */
179
+ promise: Promise<T>;
180
+ /** Function to resolve the promise with a value */
181
+ resolve: (value: T) => void;
182
+ /** Function to reject the promise with an error */
183
+ reject: (error: unknown) => void;
184
+ /** Whether the promise has been resolved */
185
+ isResolved: boolean;
186
+ /** Whether the promise has been rejected */
187
+ isRejected: boolean;
188
+ /** Whether the promise is still pending */
189
+ isPending: boolean;
190
+ }
191
+ /**
192
+ * Options for wait functions
193
+ *
194
+ * @example
195
+ * ```typescript
196
+ * const options: WaitOptions = {
197
+ * timeout: 5000, // 5 seconds
198
+ * interval: 100, // Check every 100ms
199
+ * message: 'Element did not appear in time'
200
+ * };
201
+ *
202
+ * await waitFor(() => document.querySelector('.loaded'), options);
203
+ * ```
204
+ */
205
+ export interface WaitOptions {
206
+ /** Maximum time to wait in milliseconds (default: 5000) */
207
+ timeout?: number;
208
+ /** Polling interval in milliseconds (default: 50) */
209
+ interval?: number;
210
+ /** Custom error message if timeout is reached */
211
+ message?: string;
212
+ }
213
+ /**
214
+ * Options for retry operations
215
+ *
216
+ * @example
217
+ * ```typescript
218
+ * const options: RetryOptions = {
219
+ * attempts: 3,
220
+ * delay: 1000,
221
+ * backoff: 2, // Exponential backoff
222
+ * maxDelay: 10000,
223
+ * shouldRetry: (error, attempt) => {
224
+ * // Don't retry on 4xx errors
225
+ * return error.status >= 500;
226
+ * },
227
+ * onRetry: (error, attempt) => {
228
+ * console.log(`Retry attempt ${attempt} after error:`, error);
229
+ * }
230
+ * };
231
+ *
232
+ * const result = await retry(() => unreliableAPI.call(), options);
233
+ * ```
234
+ */
235
+ export interface RetryOptions {
236
+ /** Maximum number of retry attempts (default: 3) */
237
+ attempts?: number;
238
+ /** Initial delay between retries in ms (default: 100) */
239
+ delay?: number;
240
+ /** Backoff multiplier for exponential delay (default: 2) */
241
+ backoff?: number;
242
+ /** Maximum delay between retries in ms (default: 10000) */
243
+ maxDelay?: number;
244
+ /** Function to determine if retry should occur based on error */
245
+ shouldRetry?: (error: Error, attempt: number) => boolean;
246
+ /** Callback invoked before each retry attempt */
247
+ onRetry?: (error: Error, attempt: number) => void;
248
+ }
249
+ /**
250
+ * Mock async function controller for testing
251
+ *
252
+ * @typeParam T - Type of the resolved value
253
+ *
254
+ * @example
255
+ * ```typescript
256
+ * const mockFetch: MockAsync<User[]> = createMockAsync();
257
+ *
258
+ * // Use in component
259
+ * const users = await mockFetch.mock();
260
+ *
261
+ * // Control resolution in test
262
+ * expect(mockFetch.pending).toHaveLength(1);
263
+ * mockFetch.resolve([{ id: 1, name: 'Test' }]);
264
+ *
265
+ * // Or reject
266
+ * mockFetch.reject(new Error('Network error'));
267
+ *
268
+ * // Reset for next test
269
+ * mockFetch.reset();
270
+ * ```
271
+ */
272
+ export interface MockAsync<T = void> {
273
+ /** The mock function that returns promises */
274
+ mock: Vitest.Mock;
275
+ /** Resolve the next pending promise with a value */
276
+ resolve: (value: T) => void;
277
+ /** Reject the next pending promise with an error */
278
+ reject: (error: unknown) => void;
279
+ /** Reset the mock and clear all pending promises */
280
+ reset: () => void;
281
+ /** Array of currently pending promises */
282
+ pending: DeferredPromise<T>[];
283
+ }
284
+ /**
285
+ * Controllable timer for testing time-dependent operations
286
+ *
287
+ * @example
288
+ * ```typescript
289
+ * const timer: ControllableTimer = createControllableTimer();
290
+ *
291
+ * timer.start();
292
+ * await performOperation();
293
+ * timer.stop();
294
+ *
295
+ * expect(timer.elapsed).toBeLessThan(1000);
296
+ *
297
+ * // Simulate time passing
298
+ * timer.tick(500);
299
+ * expect(timer.elapsed).toBe(500);
300
+ * ```
301
+ */
302
+ export interface ControllableTimer {
303
+ /** Start the timer */
304
+ start: () => void;
305
+ /** Stop the timer */
306
+ stop: () => void;
307
+ /** Manually advance the timer by specified milliseconds */
308
+ tick: (ms: number) => void;
309
+ /** Reset the timer to zero */
310
+ reset: () => void;
311
+ /** Get elapsed time in milliseconds */
312
+ elapsed: number;
313
+ }
314
+ /**
315
+ * Test-friendly event emitter with async support
316
+ *
317
+ * @typeParam T - Type of data emitted
318
+ *
319
+ * @example
320
+ * ```typescript
321
+ * const emitter: TestEventEmitter<UserEvent> = createTestEventEmitter();
322
+ *
323
+ * // Listen for events
324
+ * const unsubscribe = emitter.on((event) => {
325
+ * console.log('User event:', event);
326
+ * });
327
+ *
328
+ * // Emit synchronously
329
+ * emitter.emit({ type: 'login', userId: '123' });
330
+ *
331
+ * // Emit and wait for async handlers
332
+ * await emitter.emitAsync({ type: 'logout', userId: '123' });
333
+ *
334
+ * // Wait for next event
335
+ * const nextEvent = await emitter.waitForEvent(5000);
336
+ * ```
337
+ */
338
+ export interface TestEventEmitter<T = unknown> {
339
+ /** Add event listener, returns unsubscribe function */
340
+ on: (handler: (data: T) => void) => () => void;
341
+ /** Add one-time event listener, returns unsubscribe function */
342
+ once: (handler: (data: T) => void) => () => void;
343
+ /** Emit event synchronously to all listeners */
344
+ emit: (data: T) => void;
345
+ /** Emit event and wait for all async handlers to complete */
346
+ emitAsync: (data: T) => Promise<void>;
347
+ /** Remove all event listeners */
348
+ removeAllListeners: () => void;
349
+ /** Get current number of listeners */
350
+ listenerCount: () => number;
351
+ /** Wait for the next event with optional timeout */
352
+ waitForEvent: (timeout?: number) => Promise<T>;
353
+ }
354
+ /**
355
+ * Step in an async test sequence
356
+ *
357
+ * @typeParam T - Type of value returned by the step
358
+ *
359
+ * @example
360
+ * ```typescript
361
+ * const steps: AsyncTestStep<any>[] = [
362
+ * {
363
+ * name: 'Initialize database',
364
+ * action: () => db.connect(),
365
+ * delay: 100
366
+ * },
367
+ * {
368
+ * name: 'Create user',
369
+ * action: () => db.users.create({ name: 'Test' }),
370
+ * assertion: (user) => expect(user.id).toBeDefined()
371
+ * },
372
+ * {
373
+ * name: 'Cleanup',
374
+ * action: () => db.disconnect(),
375
+ * onError: (error) => console.error('Cleanup failed:', error)
376
+ * }
377
+ * ];
378
+ * ```
379
+ */
380
+ export interface AsyncTestStep<T = unknown> {
381
+ /** Descriptive name for the step */
382
+ name: string;
383
+ /** Function to execute for this step */
384
+ action: () => Promise<T> | T;
385
+ /** Optional delay before executing this step (ms) */
386
+ delay?: number;
387
+ /** Optional assertion to run after step completes */
388
+ assertion?: (result: T) => void | Promise<void>;
389
+ /** Optional error handler for this step */
390
+ onError?: (error: Error) => void;
391
+ }
392
+ /**
393
+ * Options for testing concurrent operations
394
+ *
395
+ * @example
396
+ * ```typescript
397
+ * const options: ConcurrentTestOptions = {
398
+ * operations: [
399
+ * () => api.uploadFile('file1.txt'),
400
+ * () => api.uploadFile('file2.txt'),
401
+ * () => api.uploadFile('file3.txt')
402
+ * ],
403
+ * maxConcurrency: 2, // Only 2 uploads at a time
404
+ * timeout: 30000, // 30 second timeout
405
+ * expectErrors: false // Fail if any operation throws
406
+ * };
407
+ *
408
+ * const result = await testConcurrentOperations(options);
409
+ * ```
410
+ */
411
+ export interface ConcurrentTestOptions {
412
+ /** Array of async operations to execute */
413
+ operations: Array<() => Promise<unknown>>;
414
+ /** Maximum number of operations to run simultaneously */
415
+ maxConcurrency?: number;
416
+ /** Timeout for all operations in milliseconds */
417
+ timeout?: number;
418
+ /** Whether to expect some operations to fail */
419
+ expectErrors?: boolean;
420
+ }
421
+ /**
422
+ * Options for testing rate-limited operations
423
+ *
424
+ * @example
425
+ * ```typescript
426
+ * const options: RateLimitTestOptions = {
427
+ * operation: () => api.getData(),
428
+ * requestsPerSecond: 10,
429
+ * duration: 5000, // Test for 5 seconds
430
+ * expectThrottle: true // Expect some requests to be throttled
431
+ * };
432
+ *
433
+ * const result = await testRateLimit(options);
434
+ * expect(result.actualRate).toBeLessThan(10);
435
+ * ```
436
+ */
437
+ export interface RateLimitTestOptions {
438
+ /** The operation to test for rate limiting */
439
+ operation: () => Promise<unknown>;
440
+ /** Target requests per second */
441
+ requestsPerSecond: number;
442
+ /** How long to run the test in milliseconds */
443
+ duration: number;
444
+ /** Whether to expect throttling to occur */
445
+ expectThrottle?: boolean;
446
+ }
447
+ /**
448
+ * State transition for testing state machines
449
+ *
450
+ * @typeParam T - Type of state object
451
+ *
452
+ * @example
453
+ * ```typescript
454
+ * const transitions: StateTransition<LoadingState>[] = [
455
+ * {
456
+ * from: { status: 'idle', data: null },
457
+ * to: { status: 'loading', data: null },
458
+ * action: () => store.dispatch(fetchData())
459
+ * },
460
+ * {
461
+ * from: { status: 'loading', data: null },
462
+ * to: { status: 'success', data: expect.any(Array) },
463
+ * action: () => mockApi.resolveWith([1, 2, 3]),
464
+ * delay: 100
465
+ * }
466
+ * ];
467
+ * ```
468
+ */
469
+ export interface StateTransition<T> {
470
+ /** Expected state before transition */
471
+ from: T;
472
+ /** Expected state after transition */
473
+ to: T;
474
+ /** Action that triggers the transition */
475
+ action: () => Promise<void> | void;
476
+ /** Optional delay after action before checking state */
477
+ delay?: number;
478
+ }
479
+ /**
480
+ * Expected sequence of events for testing
481
+ *
482
+ * @example
483
+ * ```typescript
484
+ * const sequence: EventSequence = {
485
+ * events: ['connect', 'authenticate', 'ready'],
486
+ * strict: true // Events must occur in exact order
487
+ * };
488
+ *
489
+ * const tracker = createEventSequenceTracker(sequence);
490
+ * ```
491
+ */
492
+ export interface EventSequence {
493
+ /** Expected event names in order */
494
+ events: string[];
495
+ /** Whether events must occur in exact order (default: true) */
496
+ strict?: boolean;
497
+ }
498
+ /**
499
+ * Cleanup operation for async resource management
500
+ *
501
+ * @example
502
+ * ```typescript
503
+ * const cleanupItems: AsyncCleanupItem[] = [
504
+ * {
505
+ * name: 'Close database',
506
+ * cleanup: () => db.close(),
507
+ * timeout: 5000
508
+ * },
509
+ * {
510
+ * name: 'Stop server',
511
+ * cleanup: async () => {
512
+ * await server.stop();
513
+ * await server.waitForClose();
514
+ * },
515
+ * timeout: 10000
516
+ * }
517
+ * ];
518
+ * ```
519
+ */
520
+ export interface AsyncCleanupItem {
521
+ /** Descriptive name for the cleanup operation */
522
+ name: string;
523
+ /** Cleanup function to execute */
524
+ cleanup: () => Promise<void> | void;
525
+ /** Optional timeout for cleanup operation */
526
+ timeout?: number;
527
+ }
528
+ /**
529
+ * Options for testing polling behavior
530
+ *
531
+ * @example
532
+ * ```typescript
533
+ * const options: PollingTestOptions = {
534
+ * pollFn: () => api.getJobStatus(jobId),
535
+ * condition: (result) => result.status === 'completed',
536
+ * maxAttempts: 20,
537
+ * interval: 1000,
538
+ * onPoll: (attempt, result) => {
539
+ * console.log(`Attempt ${attempt}: ${result.status}`);
540
+ * }
541
+ * };
542
+ *
543
+ * const result = await testPolling(options);
544
+ * ```
545
+ */
546
+ export interface PollingTestOptions {
547
+ /** Function to call on each poll */
548
+ pollFn: () => Promise<unknown> | unknown;
549
+ /** Condition to check if polling should stop */
550
+ condition: (result: unknown) => boolean;
551
+ /** Maximum number of polling attempts */
552
+ maxAttempts?: number;
553
+ /** Interval between polls in milliseconds */
554
+ interval?: number;
555
+ /** Callback invoked after each poll */
556
+ onPoll?: (attempt: number, result: unknown) => void;
557
+ }
558
+ export interface TestCleanup {
559
+ add: (cleanup: () => void | Promise<void>) => void;
560
+ runAll: () => Promise<void>;
561
+ clear: () => void;
562
+ }
563
+ export interface MockConsole {
564
+ log: Vitest.Mock;
565
+ error: Vitest.Mock;
566
+ warn: Vitest.Mock;
567
+ info: Vitest.Mock;
568
+ debug: Vitest.Mock;
569
+ restore: () => void;
570
+ }
571
+ export interface MockEnv {
572
+ set: (key: string, value: string) => void;
573
+ get: (key: string) => string | undefined;
574
+ delete: (key: string) => void;
575
+ clear: () => void;
576
+ restore: () => void;
577
+ }
578
+ export interface TestDataCleanup<T> {
579
+ register: (data: T) => T;
580
+ cleanup: () => Promise<void>;
581
+ getAll: () => T[];
582
+ }
583
+ export type RenderOptions = RTLRenderOptions;
584
+ export type RenderHookOptions<TProps> = RTLRenderHookOptions<TProps>;
585
+ export type SpyInstance = Vitest.MockedFunction<(...args: unknown[]) => unknown>;
586
+ export interface BenchmarkOptions {
587
+ iterations?: number;
588
+ time?: number;
589
+ warmup?: number;
590
+ setup?: () => void | Promise<void>;
591
+ teardown?: () => void | Promise<void>;
592
+ runs?: number;
593
+ format?: 'table' | 'json';
594
+ }
595
+ export interface TestBedConfig {
596
+ providers: Provider[];
597
+ imports?: unknown[];
598
+ exports?: unknown[];
599
+ }
600
+ export interface ControllerTestHarnessOptions<T> {
601
+ Controller: Type<T>;
602
+ dependencies?: Array<{
603
+ token: unknown;
604
+ value: unknown;
605
+ }>;
606
+ mockLogger?: boolean;
607
+ }
608
+ export interface ValidateMiddlwareResponseExpected {
609
+ type: 'next' | 'redirect' | 'rewrite' | 'response';
610
+ url?: string;
611
+ status?: number;
612
+ }
613
+ export interface ServiceTestHarnessOptions<T> {
614
+ Service: Type<T>;
615
+ dependencies?: Array<{
616
+ token: unknown;
617
+ value: unknown;
618
+ }>;
619
+ mockLogger?: boolean;
620
+ }
621
+ export type NestModule = Type<unknown>;
622
+ export interface ModuleTestHarnessOptions {
623
+ Module: NestModule;
624
+ overrideProviders?: Array<{
625
+ token: unknown;
626
+ useValue?: unknown;
627
+ useFactory?: (...args: unknown[]) => unknown;
628
+ }>;
629
+ }
630
+ export interface NextPageTestOptions extends RenderOptions {
631
+ router?: Partial<MockNextRouter>;
632
+ mockModules?: Array<'router' | 'image' | 'link' | 'head'>;
633
+ }
634
+ export type NextApiRequest = NextJSApiRequest;
635
+ export type NextApiResponse = NextJSApiResponse;
636
+ export interface ApiRouteTestContext {
637
+ req: NextApiRequest;
638
+ res: NextApiResponse;
639
+ expectStatus: (status: number) => void;
640
+ expectJson: (data: unknown) => void;
641
+ expectRedirect: (url: string, status?: number) => void;
642
+ expectHeader: (name: string, value: string | string[]) => void;
643
+ }
644
+ export interface MiddlewareTestContext {
645
+ request: Request;
646
+ event: {
647
+ request: Request;
648
+ waitUntil: (promise: Promise<unknown>) => void;
649
+ };
650
+ expectRedirect: (url: string) => void;
651
+ expectRewrite: (url: string) => void;
652
+ expectHeader: (name: string, value: string) => void;
653
+ expectNext: () => void;
654
+ }
655
+ export interface AppRouterHookTestOptions<TProps> extends RenderHookOptions<TProps> {
656
+ pathname?: string;
657
+ searchParams?: Record<string, string | string[]>;
658
+ params?: Record<string, string | string[]>;
659
+ }
660
+ export type UserEvent = UserEventLib;
661
+ export interface UserEventConfig {
662
+ delay?: number;
663
+ advanceTimers?: (ms: number) => void | Promise<void>;
664
+ applyAccept?: boolean;
665
+ autoModify?: boolean;
666
+ skipAutoClose?: boolean;
667
+ writeToClipboard?: boolean;
668
+ }
669
+ export interface InteractionSequence {
670
+ type: 'click' | 'type' | 'select' | 'check' | 'focus' | 'blur' | 'hover' | 'key' | 'paste' | 'clear' | 'upload' | 'drag' | 'scroll' | 'wait' | 'tab' | 'keyboard';
671
+ target?: string | HTMLElement;
672
+ value?: string | string[] | boolean | File | File[];
673
+ wait?: number;
674
+ options?: {
675
+ delay?: number;
676
+ position?: {
677
+ x: number;
678
+ y: number;
679
+ };
680
+ key?: string;
681
+ modifiers?: Array<'Shift' | 'Control' | 'Alt' | 'Meta'>;
682
+ skipClick?: boolean;
683
+ skipHover?: boolean;
684
+ scrollIntoView?: boolean;
685
+ force?: boolean;
686
+ timeout?: number;
687
+ waitForElement?: boolean;
688
+ direction?: 'up' | 'down' | 'left' | 'right';
689
+ distance?: number;
690
+ };
691
+ }
692
+ export interface MockChildProcessInstance {
693
+ stdout: {
694
+ on: {
695
+ mock: {
696
+ calls: Array<[string, Function]>;
697
+ };
698
+ };
699
+ };
700
+ stderr: {
701
+ on: {
702
+ mock: {
703
+ calls: Array<[string, Function]>;
704
+ };
705
+ };
706
+ };
707
+ on: {
708
+ mock: {
709
+ calls: Array<[string, Function]>;
710
+ };
711
+ };
712
+ [key: string]: unknown;
713
+ }
714
+ export interface ProcessTestUtils {
715
+ simulateSignal: (signal: string) => void;
716
+ expectExit: (code?: number) => void;
717
+ captureOutput: () => {
718
+ stdout: string[];
719
+ stderr: string[];
720
+ };
721
+ simulateUncaughtException: (error: Error) => void;
722
+ simulateUnhandledRejection: (reason: unknown) => void;
723
+ }
724
+ export interface ChildProcessTestUtils {
725
+ expectCommand: (command: string, args?: string[]) => void;
726
+ simulateOutput: (stdout: string, stderr?: string) => void;
727
+ simulateError: (error: Error) => void;
728
+ simulateExit: (code: number) => void;
729
+ getLastProcess: () => unknown;
730
+ }
731
+ export interface StreamTestUtils {
732
+ pipeData: (data: string | globalThis.Buffer) => void;
733
+ endStream: () => void;
734
+ expectPipedTo: (destination: unknown) => void;
735
+ getWrittenData: () => Array<string | globalThis.Buffer>;
736
+ }
737
+ export interface EventDrivenTestUtils {
738
+ emitter: MockEventEmitter;
739
+ expectEvent: (event: string, payload?: unknown) => void;
740
+ expectNoEvent: (event: string) => void;
741
+ simulateEvents: (events: Array<SimulatedEvent>) => Promise<void>;
742
+ getEventHistory: () => Array<EventHistoryEntry>;
743
+ }
744
+ export interface TestServer {
745
+ url: string;
746
+ port: number;
747
+ close: () => Promise<void>;
748
+ on: (event: string, handler: Function) => void;
749
+ }
750
+ export interface ConcurrentOperationResult {
751
+ success: boolean;
752
+ result?: unknown;
753
+ error?: Error;
754
+ duration: number;
755
+ }
756
+ export interface ConcurrentTestResult {
757
+ results: ConcurrentOperationResult[];
758
+ totalDuration: number;
759
+ successCount: number;
760
+ errorCount: number;
761
+ averageDuration: number;
762
+ }
763
+ export interface RateLimitResult {
764
+ timestamp: number;
765
+ success: boolean;
766
+ error?: Error;
767
+ }
768
+ export interface RateLimitTestResult {
769
+ results: RateLimitResult[];
770
+ actualRate: number;
771
+ wasThrottled: boolean;
772
+ }
773
+ export interface PollingAttempt {
774
+ attempt: number;
775
+ result: unknown;
776
+ timestamp: number;
777
+ }
778
+ export interface PollingTestResult {
779
+ attempts: PollingAttempt[];
780
+ conditionMet: boolean;
781
+ totalAttempts: number;
782
+ totalDuration: number;
783
+ }
784
+ export interface DebounceTestResult {
785
+ callCount: number;
786
+ lastCallTime: number;
787
+ }
788
+ export interface ThrottleCall {
789
+ args: unknown[];
790
+ delay: number;
791
+ }
792
+ export interface ThrottleResult {
793
+ called: boolean;
794
+ args?: unknown[];
795
+ }
796
+ export interface AsyncScenario<T> {
797
+ name: string;
798
+ setup: () => Promise<void>;
799
+ action: () => Promise<T>;
800
+ verify: (result: T) => void | Promise<void>;
801
+ cleanup?: () => Promise<void>;
802
+ }
803
+ export interface WaitForChangeOptions<T> {
804
+ timeout?: number;
805
+ interval?: number;
806
+ compareFn?: (a: T, b: T) => boolean;
807
+ }
808
+ export interface PerformanceMetrics {
809
+ min: number;
810
+ max: number;
811
+ mean: number;
812
+ median: number;
813
+ p95: number;
814
+ p99: number;
815
+ runs: number[];
816
+ }
817
+ export interface MeasureTimeOptions {
818
+ warmup?: number;
819
+ runs?: number;
820
+ }
821
+ export interface MeasureTimeResult<T> {
822
+ result: T;
823
+ duration: number;
824
+ metrics?: PerformanceMetrics;
825
+ }
826
+ export interface BenchmarkResult {
827
+ [functionName: string]: PerformanceMetrics;
828
+ }
829
+ export interface LoadTestOptions {
830
+ duration?: number;
831
+ concurrency?: number;
832
+ rampUp?: number;
833
+ onProgress?: (stats: LoadTestStats) => void;
834
+ }
835
+ export interface LoadTestStats {
836
+ totalRequests: number;
837
+ successfulRequests: number;
838
+ failedRequests: number;
839
+ latencies: number[];
840
+ errors: Error[];
841
+ }
842
+ export interface LoadTestResult {
843
+ totalRequests: number;
844
+ successfulRequests: number;
845
+ failedRequests: number;
846
+ averageLatency: number;
847
+ throughput: number;
848
+ errors: Error[];
849
+ }
850
+ export interface ProfileCPUOptions {
851
+ sampleInterval?: number;
852
+ }
853
+ export interface CPUProfile {
854
+ samples: number[];
855
+ duration: number;
856
+ }
857
+ export interface ProfileCPUResult<T> {
858
+ result: T;
859
+ profile: CPUProfile;
860
+ }
861
+ export interface ScalabilityTestOptions {
862
+ expectedComplexity?: 'constant' | 'logarithmic' | 'linear' | 'quadratic';
863
+ tolerance?: number;
864
+ }
865
+ export interface ScalabilityMeasurement {
866
+ size: number;
867
+ time: number;
868
+ }
869
+ export interface ScalabilityTestResult {
870
+ measurements: ScalabilityMeasurement[];
871
+ complexity: string;
872
+ isWithinExpected: boolean;
873
+ }
874
+ export interface PerformanceComparisonOptions {
875
+ runs?: number;
876
+ chart?: boolean;
877
+ }
878
+ export interface PerformanceComparisonInput<T> {
879
+ name: string;
880
+ value: T;
881
+ }
882
+ export interface MemoryMeasurement {
883
+ before: number;
884
+ after: number;
885
+ delta: number;
886
+ peak: number;
887
+ }
888
+ export interface MeasureMemoryOptions {
889
+ forceGC?: boolean;
890
+ runs?: number;
891
+ }
892
+ export interface MeasureMemoryResult<T> {
893
+ result: T;
894
+ memory: MemoryMeasurement;
895
+ }
896
+ export interface PerformanceConstraints {
897
+ maxTime?: number;
898
+ maxMemory?: number;
899
+ minThroughput?: number;
900
+ }
901
+ export interface AssertPerformanceOptions {
902
+ runs?: number;
903
+ duration?: number;
904
+ }
905
+ export interface EventHistoryEntry {
906
+ event: string;
907
+ payload: unknown;
908
+ timestamp: number;
909
+ }
910
+ export interface SimulatedEvent {
911
+ event: string;
912
+ payload?: unknown;
913
+ delay?: number;
914
+ }
915
+ export interface WebSocketMockOptions {
916
+ url?: string;
917
+ protocol?: string;
918
+ extensions?: string;
919
+ readyState?: number;
920
+ bufferedAmount?: number;
921
+ }
922
+ export interface WebSocketServerMockOptions {
923
+ port?: number;
924
+ host?: string;
925
+ maxClients?: number;
926
+ }
927
+ export interface WebSocketTestScenario {
928
+ name: string;
929
+ message: unknown;
930
+ expectedResponse?: unknown;
931
+ expectedBroadcast?: unknown;
932
+ shouldError?: boolean;
933
+ errorMessage?: string;
934
+ }
935
+ export interface WebSocketConnectionOptions {
936
+ url: string;
937
+ protocols?: string | string[];
938
+ headers?: Record<string, string>;
939
+ timeout?: number;
940
+ }
941
+ export interface FileOperationTest {
942
+ name: string;
943
+ operation: (fs: unknown) => void | Promise<void>;
944
+ expectedFiles?: Map<string, string | globalThis.Buffer>;
945
+ expectedError?: string | RegExp;
946
+ }
947
+ export interface SignalTest {
948
+ signal: string;
949
+ expectedBehavior: () => void;
950
+ }
951
+ export interface AriaAttributes {
952
+ ariaLabel?: string;
953
+ ariaLabelledby?: string;
954
+ ariaDescribedby?: string;
955
+ ariaExpanded?: boolean;
956
+ ariaHidden?: boolean;
957
+ ariaLive?: 'off' | 'polite' | 'assertive';
958
+ ariaAtomic?: boolean;
959
+ ariaBusy?: boolean;
960
+ ariaChecked?: boolean;
961
+ ariaDisabled?: boolean;
962
+ ariaInvalid?: boolean;
963
+ ariaPressed?: boolean;
964
+ ariaReadonly?: boolean;
965
+ ariaRequired?: boolean;
966
+ ariaSelected?: boolean;
967
+ role?: string;
968
+ tabIndex?: number;
969
+ }
970
+ export interface KeyboardNavigationTest {
971
+ element: HTMLElement;
972
+ key: string;
973
+ expectedBehavior: 'focus' | 'activate' | 'navigate' | 'ignore';
974
+ expectedTarget?: HTMLElement;
975
+ }
976
+ export interface ScreenReaderTest {
977
+ element: HTMLElement;
978
+ expectedText: string | RegExp;
979
+ includeHidden?: boolean;
980
+ }
981
+ export interface LifecycleHook {
982
+ name: string;
983
+ method: string;
984
+ phase: 'mount' | 'update' | 'unmount' | 'init' | 'destroy';
985
+ required?: boolean;
986
+ async?: boolean;
987
+ }
988
+ export interface ComponentLifecycleTest {
989
+ name: string;
990
+ Component: React.ComponentType<unknown>;
991
+ props?: Record<string, unknown>;
992
+ expectedHooks: LifecycleHook[];
993
+ interactions?: Array<{
994
+ action: () => void | Promise<void>;
995
+ expectedHooksAfter: string[];
996
+ }>;
997
+ }
998
+ export interface ServiceWithLifecycle {
999
+ onModuleInit?: () => Promise<void>;
1000
+ onModuleDestroy?: () => Promise<void>;
1001
+ onApplicationBootstrap?: () => Promise<void>;
1002
+ onApplicationShutdown?: () => Promise<void>;
1003
+ [key: string]: unknown;
1004
+ }
1005
+ export interface ServiceLifecycleTest {
1006
+ name: string;
1007
+ Service: new (...args: unknown[]) => ServiceWithLifecycle;
1008
+ dependencies?: unknown[];
1009
+ expectedHooks: LifecycleHook[];
1010
+ cleanupExpected?: boolean;
1011
+ }
1012
+ export interface ProviderWithLifecycle {
1013
+ constructor: {
1014
+ name: string;
1015
+ };
1016
+ onModuleInit?: () => Promise<void>;
1017
+ onModuleDestroy?: () => Promise<void>;
1018
+ [key: string]: unknown;
1019
+ }
1020
+ export interface ModuleLifecycleTest {
1021
+ name: string;
1022
+ Module: new (...args: unknown[]) => unknown;
1023
+ providers: ProviderWithLifecycle[];
1024
+ expectedInitOrder: string[];
1025
+ expectedDestroyOrder: string[];
1026
+ }
1027
+ export interface ApplicationLifecycleTest {
1028
+ name: string;
1029
+ app: Record<string, unknown>;
1030
+ modules: unknown[];
1031
+ expectedStartupSequence: string[];
1032
+ expectedShutdownSequence: string[];
1033
+ }
1034
+ export interface TestSuiteConfig<T> {
1035
+ name: string;
1036
+ createInstance: () => T;
1037
+ defaultProps?: unknown;
1038
+ setupBeforeAll?: () => void | Promise<void>;
1039
+ setupBeforeEach?: () => void | Promise<void>;
1040
+ teardownAfterEach?: () => void | Promise<void>;
1041
+ teardownAfterAll?: () => void | Promise<void>;
1042
+ }
1043
+ export interface EnvironmentConfig {
1044
+ [key: string]: string | undefined;
1045
+ }
1046
+ export interface AnimationTestOptions {
1047
+ duration?: number;
1048
+ easing?: string;
1049
+ delay?: number;
1050
+ iterations?: number;
1051
+ direction?: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse';
1052
+ fillMode?: 'none' | 'forwards' | 'backwards' | 'both';
1053
+ }
1054
+ export interface TransitionTestOptions {
1055
+ property?: string;
1056
+ duration?: number;
1057
+ timingFunction?: string;
1058
+ delay?: number;
1059
+ }
1060
+ export interface KeyframeTest {
1061
+ percentage: number;
1062
+ styles: Record<string, string>;
1063
+ }
1064
+ export interface AnimationSequence {
1065
+ name: string;
1066
+ steps: Array<{
1067
+ delay?: number;
1068
+ duration: number;
1069
+ styles: Record<string, string>;
1070
+ easing?: string;
1071
+ }>;
1072
+ }
1073
+ export interface EnvironmentTestCase {
1074
+ name: string;
1075
+ environment: EnvironmentConfig;
1076
+ expectedBehavior: () => void | Promise<void>;
1077
+ cleanup?: () => void | Promise<void>;
1078
+ }
1079
+ export interface ConfigTestScenario {
1080
+ name: string;
1081
+ config: Record<string, unknown>;
1082
+ environment?: EnvironmentConfig;
1083
+ expectedValues: Record<string, unknown>;
1084
+ shouldThrow?: boolean;
1085
+ expectedError?: string | RegExp;
1086
+ }
1087
+ export interface SpringConfig {
1088
+ tension: number;
1089
+ friction: number;
1090
+ mass: number;
1091
+ }
1092
+ export interface RAFCallback {
1093
+ id: number;
1094
+ callback: FrameRequestCallback;
1095
+ }
1096
+ export interface LoadingState {
1097
+ isLoading?: boolean;
1098
+ loading?: boolean;
1099
+ }
1100
+ export interface ForTextOptions {
1101
+ timeout?: number;
1102
+ }
1103
+ export interface TestValueWithIndex<T> {
1104
+ value: T;
1105
+ index: number;
1106
+ }
1107
+ export interface CallRecord {
1108
+ method: string;
1109
+ args: unknown[];
1110
+ timestamp: number;
1111
+ }
1112
+ export interface ModuleSpy<T> {
1113
+ module: T;
1114
+ calls: CallRecord[];
1115
+ }
1116
+ export interface NamedTestCase<T> {
1117
+ name: string;
1118
+ input: T;
1119
+ expected: unknown;
1120
+ }
1121
+ export type NodeTimeout = ReturnType<typeof globalThis.setTimeout>;
1122
+ export interface NavigationOptions {
1123
+ shallow?: boolean;
1124
+ }
1125
+ export interface ImageLoaderProps {
1126
+ src: string;
1127
+ width: number;
1128
+ quality?: number;
1129
+ }
1130
+ export interface PerformanceMemory {
1131
+ memory?: {
1132
+ usedJSHeapSize: number;
1133
+ };
1134
+ }
1135
+ export interface NextPageResult {
1136
+ props?: unknown;
1137
+ redirect?: {
1138
+ destination: string;
1139
+ permanent?: boolean;
1140
+ statusCode?: number;
1141
+ };
1142
+ notFound?: boolean;
1143
+ }
1144
+ export interface MockCallResult {
1145
+ args: unknown[];
1146
+ result: unknown;
1147
+ error?: unknown;
1148
+ }
1149
+ export interface FileWatcher extends MockEventEmitter {
1150
+ add: Vitest.Mock;
1151
+ unwatch: Vitest.Mock;
1152
+ close: Vitest.Mock;
1153
+ getWatched: Vitest.Mock;
1154
+ simulateChange: (path: string) => void;
1155
+ simulateAdd: (path: string) => void;
1156
+ simulateUnlink: (path: string) => void;
1157
+ }
1158
+ export interface NestJSTestBed {
1159
+ get: <T>(token: unknown) => T;
1160
+ close: () => Promise<void>;
1161
+ moduleRef: Map<unknown, unknown>;
1162
+ }
1163
+ export interface ModuleTestHarness {
1164
+ moduleRef: {
1165
+ get: <T>(token: unknown) => T;
1166
+ close: () => Promise<void>;
1167
+ moduleRef: Map<unknown, unknown>;
1168
+ };
1169
+ get: <T>(token: unknown) => T;
1170
+ close: () => Promise<void>;
1171
+ }
1172
+ export interface NextRouterHelpers {
1173
+ navigateTo: (url: string, options?: NavigationOptions) => Promise<void>;
1174
+ simulateRouteChange: (fromUrl: string, toUrl: string) => void;
1175
+ simulateRouteError: (url: string, error: Error) => void;
1176
+ expectNavigation: (url: string, type?: 'push' | 'replace') => void;
1177
+ expectNoNavigation: () => void;
1178
+ }
1179
+ export interface MockNextRouterReturn {
1180
+ router: MockNextRouter;
1181
+ useRouter: CreateMockUseRouterReturn;
1182
+ restore: () => void;
1183
+ }
1184
+ export interface MockNextRequest {
1185
+ url: string;
1186
+ method: string;
1187
+ headers: Headers;
1188
+ body: unknown;
1189
+ ip: string;
1190
+ searchParams?: Record<string, string>;
1191
+ nextUrl: {
1192
+ pathname: string;
1193
+ searchParams: URLSearchParams;
1194
+ origin: string;
1195
+ href: string;
1196
+ };
1197
+ cookies: {
1198
+ get: Vitest.Mock;
1199
+ set: Vitest.Mock;
1200
+ delete: Vitest.Mock;
1201
+ };
1202
+ geo: {
1203
+ city: string;
1204
+ country: string;
1205
+ region: string;
1206
+ latitude: string;
1207
+ longitude: string;
1208
+ };
1209
+ }
1210
+ export interface MockNextResponse {
1211
+ cookies: {
1212
+ set: Vitest.Mock;
1213
+ delete: Vitest.Mock;
1214
+ };
1215
+ headers: Headers;
1216
+ status: number;
1217
+ redirect: Vitest.Mock;
1218
+ rewrite: Vitest.Mock;
1219
+ next: Vitest.Mock;
1220
+ json: Vitest.Mock;
1221
+ }
1222
+ export interface MockWebSocketServer extends MockEventEmitter {
1223
+ clients: Set<CreateMockWebSocketReturn>;
1224
+ port: number;
1225
+ host: string;
1226
+ maxClients: number;
1227
+ handleUpgrade: Vitest.Mock;
1228
+ shouldHandle: Vitest.Mock;
1229
+ close: Vitest.Mock;
1230
+ addClient: (client: CreateMockWebSocketReturn) => void;
1231
+ removeClient: (client: CreateMockWebSocketReturn) => void;
1232
+ simulateConnection: (clientId?: string) => CreateMockWebSocketReturn;
1233
+ simulateBroadcast: (data: unknown, excludeClient?: string) => void;
1234
+ simulateClientDisconnect: (clientId: string) => void;
1235
+ }
1236
+ export interface MockWebSocketGlobal {
1237
+ restore: () => void;
1238
+ }
1239
+ export interface MockSystemDateReturn {
1240
+ setDate: (newDate: Date | string | number) => void;
1241
+ advanceBy: (ms: number) => void;
1242
+ }
1243
+ export type GetStaticPathsResult = NextGetStaticPathsResult;
1244
+ export interface GetStaticPathsExpectations {
1245
+ pathCount?: number;
1246
+ fallback: boolean | 'blocking';
1247
+ validatePaths?: (paths: Array<string | {
1248
+ params: Record<string, string | string[] | undefined>;
1249
+ }>) => void;
1250
+ }
1251
+ export interface ImageOptimizationScenario {
1252
+ src: string;
1253
+ width: number;
1254
+ quality?: number;
1255
+ expectedUrl: string;
1256
+ alt: string;
1257
+ priority?: boolean;
1258
+ height?: number;
1259
+ }
1260
+ export interface DragAndDropOptions {
1261
+ dragData?: Record<string, string>;
1262
+ expectedDropEffect?: 'copy' | 'move' | 'link' | 'none';
1263
+ }
1264
+ export interface TypeRealisticOptions {
1265
+ pauseBetweenChars?: number;
1266
+ typos?: boolean;
1267
+ speed?: 'slow' | 'normal' | 'fast';
1268
+ }
1269
+ export interface LoadingComponentExpectations {
1270
+ testId?: string;
1271
+ text?: string;
1272
+ className?: string;
1273
+ }
1274
+ export interface MiddlewareTestScenarioWithRequest {
1275
+ name: string;
1276
+ request: Parameters<CreateMockNextRequestFunction>;
1277
+ expected: {
1278
+ type: 'next' | 'redirect' | 'rewrite' | 'response';
1279
+ url?: string;
1280
+ headers?: Record<string, string>;
1281
+ status?: number;
1282
+ };
1283
+ }
1284
+ export interface ApiRouteHandlerMethods {
1285
+ GET?: Function;
1286
+ POST?: Function;
1287
+ PUT?: Function;
1288
+ DELETE?: Function;
1289
+ PATCH?: Function;
1290
+ }
1291
+ export interface RouteHandlerTestScenario {
1292
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
1293
+ request: Parameters<CreateMockNextRequestFunction>;
1294
+ expectedStatus: number;
1295
+ expectedBody?: unknown;
1296
+ }
1297
+ export interface ImageLoaderTestScenario {
1298
+ input: ImageLoaderInput;
1299
+ expectedUrl: string | RegExp;
1300
+ }
1301
+ export interface ParameterizedTest<T> {
1302
+ test: (name: string, fn: (input: T, expected: unknown) => void | Promise<void>) => void;
1303
+ }
1304
+ export interface ServiceTestSuite<T> {
1305
+ testMethods: () => void;
1306
+ testErrorHandling: (errorScenarios: Array<ErrorScenario<T>>) => void;
1307
+ }
1308
+ export interface NestJSTestSuiteReturn {
1309
+ testProviderRegistration: (providerTokens: unknown[]) => void;
1310
+ testProviderInjection: (injectionTests: Array<ProviderInjectionTest>) => void;
1311
+ }
1312
+ export interface NextJSTestSuite {
1313
+ testStaticGeneration: (getStaticProps?: Function, getStaticPaths?: Function) => void;
1314
+ testServerSideRendering: (getServerSideProps?: Function) => void;
1315
+ testPageRendering: (scenarios: Array<PropsTestScenario>) => void;
1316
+ }
1317
+ export interface TestSuiteFactory<T extends UnknownRecord> {
1318
+ runScenarios: (scenarios: TestScenario<T, unknown, unknown>[]) => void;
1319
+ testMethod: (methodName: keyof T, testCases: Array<TestCaseWithSetup<T>>) => void;
1320
+ testLifecycle: (lifecycleHooks: Array<LifecycleHookTestConfig<T>>) => void;
1321
+ testErrorHandling: (errorScenarios: Array<ErrorHandlingScenario<T>>) => void;
1322
+ }
1323
+ export interface ConditionalMockBehavior<T> {
1324
+ predicate: (...args: unknown[]) => boolean;
1325
+ result: T | (() => T);
1326
+ }
1327
+ export interface MockModuleResult {
1328
+ unmock: () => void;
1329
+ }
1330
+ export interface MockManyResult {
1331
+ unmockAll: () => void;
1332
+ }
1333
+ export interface RouteMatchResult {
1334
+ params: Record<string, string | string[]>;
1335
+ isMatch: boolean;
1336
+ }
1337
+ export interface PerformanceEntryResult {
1338
+ name: string;
1339
+ metrics: PerformanceMetrics;
1340
+ }
1341
+ export interface MemoryMeasurementResult<T> {
1342
+ measurement: MemoryMeasurement;
1343
+ result: T;
1344
+ }
1345
+ export interface GlobalWithGC {
1346
+ gc?: () => void;
1347
+ }
1348
+ export interface MemoryLeakTestResult {
1349
+ initialMemory: number;
1350
+ finalMemory: number;
1351
+ memoryIncrease: number;
1352
+ iterations: number;
1353
+ }
1354
+ export interface PropVariation {
1355
+ name: string;
1356
+ props: Record<string, unknown>;
1357
+ expectation: () => void;
1358
+ }
1359
+ export interface ValidTestCase<T> {
1360
+ name: string;
1361
+ input: unknown;
1362
+ expected?: T;
1363
+ }
1364
+ export interface InvalidTestCase {
1365
+ name: string;
1366
+ input: unknown;
1367
+ expectedError: string | RegExp;
1368
+ }
1369
+ export interface CreatedResource {
1370
+ name: string;
1371
+ resource: unknown;
1372
+ }
1373
+ export interface LifecycleHookRecord {
1374
+ phase: string;
1375
+ method: string;
1376
+ timestamp: number;
1377
+ }
1378
+ export interface PathMatchTest {
1379
+ path: string;
1380
+ shouldMatch: boolean;
1381
+ }
1382
+ export interface ErrorScenario<T> {
1383
+ method: string;
1384
+ setup: (service: T) => void;
1385
+ expectedError: unknown;
1386
+ }
1387
+ export interface PropsTestScenario {
1388
+ props: Record<string, unknown>;
1389
+ expectedContent?: string;
1390
+ }
1391
+ export interface ResponsiveBreakpoint {
1392
+ width: number;
1393
+ height: number;
1394
+ expectations: () => void;
1395
+ }
1396
+ export type TestCombination<T extends Record<string, unknown[]>> = {
1397
+ [K in keyof T]: T[K][number];
1398
+ };
1399
+ export interface TestDependency {
1400
+ token: unknown;
1401
+ value: unknown;
1402
+ }
1403
+ export type LoadingResult = {
1404
+ current: LoadingState;
1405
+ } | {
1406
+ result: {
1407
+ current: LoadingState;
1408
+ };
1409
+ };
1410
+ export interface TableTestCase<TInput, TExpected> {
1411
+ name: string;
1412
+ input: TInput;
1413
+ expected: TExpected;
1414
+ skip?: boolean;
1415
+ only?: boolean;
1416
+ error?: boolean;
1417
+ }
1418
+ export interface EdgeCaseTest<T, R> {
1419
+ name: string;
1420
+ input: T;
1421
+ expected?: R;
1422
+ shouldThrow?: string | RegExp | Error;
1423
+ }
1424
+ export interface AnimationPerformanceMetrics {
1425
+ avgFrameTime: number;
1426
+ avgFPS: number;
1427
+ maxFrameTime: number;
1428
+ minFrameTime: number;
1429
+ frameTimes: number[];
1430
+ }
1431
+ export interface AnimationPerformanceOptions {
1432
+ iterations?: number;
1433
+ maxFrameTime?: number;
1434
+ minFPS?: number;
1435
+ }
1436
+ export type ServerSidePropsResult<T> = {
1437
+ props: T;
1438
+ } | {
1439
+ redirect: unknown;
1440
+ } | {
1441
+ notFound: true;
1442
+ };
1443
+ export type StaticPropsResult<T> = {
1444
+ props: T;
1445
+ revalidate?: number;
1446
+ } | {
1447
+ redirect: unknown;
1448
+ } | {
1449
+ notFound: true;
1450
+ };
1451
+ export interface ServerSidePropsTestResult<T> {
1452
+ result: ServerSidePropsResult<T>;
1453
+ context: MockGetServerSidePropsContext;
1454
+ expectProps: (props: Partial<T>) => void;
1455
+ expectRedirect: (destination: string, permanent?: boolean) => void;
1456
+ expectNotFound: () => void;
1457
+ }
1458
+ export interface StaticPropsTestResult<T> {
1459
+ result: StaticPropsResult<T>;
1460
+ context: MockGetStaticPropsContext;
1461
+ expectProps: (props: Partial<T>) => void;
1462
+ expectRedirect: (destination: string, permanent?: boolean) => void;
1463
+ expectNotFound: () => void;
1464
+ expectRevalidate: (seconds: number) => void;
1465
+ }
1466
+ export interface CreateCustomQueriesReturn {
1467
+ getByClassName: (className: string) => HTMLElement;
1468
+ getAllByClassName: (className: string) => HTMLElement[];
1469
+ getByAttribute: (attribute: string, value?: string) => HTMLElement;
1470
+ }
1471
+ export interface BoundaryValueTest<T> {
1472
+ value: T;
1473
+ description: string;
1474
+ expected: unknown;
1475
+ }
1476
+ export interface EquivalenceClassTest<T, R> {
1477
+ name: string;
1478
+ samples: T[];
1479
+ expected: R;
1480
+ }
1481
+ export interface StateTransitionTest<TState, TAction> {
1482
+ from: TState;
1483
+ action: TAction;
1484
+ to: TState;
1485
+ description?: string;
1486
+ }
1487
+ export interface SnapshotTestCase<T> {
1488
+ name: string;
1489
+ input: T;
1490
+ transform?: (input: T) => unknown;
1491
+ }
1492
+ export interface CombinationTestOptions<T extends Record<string, unknown[]>> {
1493
+ filter?: (combination: TestCombination<T>) => boolean;
1494
+ maxCombinations?: number;
1495
+ }
1496
+ export interface FuzzyTestOptions<T, R> {
1497
+ generateInput: () => T;
1498
+ fn: (input: T) => R;
1499
+ invariant: (input: T, output: R) => boolean;
1500
+ options?: {
1501
+ iterations?: number;
1502
+ seed?: number;
1503
+ };
1504
+ }
1505
+ export interface PropertyTestOptions {
1506
+ runs?: number;
1507
+ seed?: number;
1508
+ onFailure?: (value: unknown, index: number) => void;
1509
+ }
1510
+ export interface AnimationCheckpoint {
1511
+ progress: number;
1512
+ expectedState: () => void;
1513
+ }
1514
+ export interface ParallaxElement {
1515
+ element: HTMLElement;
1516
+ speed: number;
1517
+ }
1518
+ export interface SpringAnimationConfigTest {
1519
+ name: string;
1520
+ tension: number;
1521
+ friction: number;
1522
+ mass: number;
1523
+ expectedDuration: number;
1524
+ }
1525
+ export interface AnimationStateMachine {
1526
+ currentState: string;
1527
+ transition: (to: string) => Promise<void>;
1528
+ getState: () => string;
1529
+ }
1530
+ export interface AnimationStateTransition {
1531
+ from: string;
1532
+ to: string;
1533
+ duration: number;
1534
+ isValid: boolean;
1535
+ }
1536
+ export interface AnimationTestUtils {
1537
+ tick: (deltaTime?: number) => void;
1538
+ advanceTime: (time: number) => void;
1539
+ restore: () => void;
1540
+ getPendingCallbacks: () => number;
1541
+ }
1542
+ export interface EnvironmentManager {
1543
+ set: (env: EnvironmentConfig) => void;
1544
+ merge: (env: EnvironmentConfig) => void;
1545
+ unset: (keys: string[]) => void;
1546
+ restore: () => void;
1547
+ reset: () => void;
1548
+ getCurrent: () => EnvironmentConfig;
1549
+ has: (key: string) => boolean;
1550
+ get: (key: string, defaultValue?: string) => string | undefined;
1551
+ clearAll: () => void;
1552
+ }
1553
+ export interface EnvironmentHooks {
1554
+ setup: () => void;
1555
+ teardown: () => void;
1556
+ getManager: () => EnvironmentManager;
1557
+ useEnvironment: (env: EnvironmentConfig) => void;
1558
+ }
1559
+ export interface EnvironmentValidationTestCase {
1560
+ name: string;
1561
+ environment: EnvironmentConfig;
1562
+ shouldPass: boolean;
1563
+ expectedErrors?: string[];
1564
+ }
1565
+ export interface EnvironmentFeatureFlagScenario {
1566
+ environment: EnvironmentConfig;
1567
+ flag: string;
1568
+ defaultValue?: boolean;
1569
+ expectedValue: boolean;
1570
+ }
1571
+ export interface DatabaseEnvironmentTest {
1572
+ name: string;
1573
+ environment: EnvironmentConfig;
1574
+ expectedConfig: Record<string, unknown>;
1575
+ shouldConnect: boolean;
1576
+ }
1577
+ export interface LoggingEnvironmentTest {
1578
+ name: string;
1579
+ environment: EnvironmentConfig;
1580
+ expectedLevel: string;
1581
+ expectedFormat?: string;
1582
+ expectedTransports?: string[];
1583
+ }
1584
+ export interface APIClientEnvironmentTest {
1585
+ name: string;
1586
+ environment: EnvironmentConfig;
1587
+ expectedBaseURL: string;
1588
+ expectedTimeout: number;
1589
+ expectedHeaders?: Record<string, string>;
1590
+ }
1591
+ export interface SecretsManagementTest {
1592
+ name: string;
1593
+ environment: EnvironmentConfig;
1594
+ secrets: Record<string, string>;
1595
+ expectedBehavior: 'store' | 'mock' | 'error';
1596
+ }
1597
+ export interface SecretsManager {
1598
+ get: (key: string) => Promise<string | undefined>;
1599
+ set: (key: string, value: string) => Promise<void>;
1600
+ delete: (key: string) => Promise<void>;
1601
+ }
1602
+ export interface MockEnvironment {
1603
+ update: (updates: EnvironmentConfig) => void;
1604
+ get: (key: string) => string | undefined;
1605
+ set: (key: string, value: string) => void;
1606
+ unset: (key: string) => void;
1607
+ restore: () => void;
1608
+ getAll: () => EnvironmentConfig;
1609
+ clear: () => void;
1610
+ }
1611
+ export interface EnvironmentTransformationTestCase {
1612
+ input: EnvironmentConfig;
1613
+ expectedOutput: Record<string, unknown>;
1614
+ description: string;
1615
+ }
1616
+ export interface UserInteraction {
1617
+ keyboard: (keys: string) => Promise<void>;
1618
+ tab?: () => Promise<void>;
1619
+ click?: (element: HTMLElement) => Promise<void>;
1620
+ }
1621
+ export interface AccessibilityReport {
1622
+ hasAccessibleName: boolean;
1623
+ isVisible: boolean;
1624
+ isFocusable: boolean;
1625
+ hasProperRole: boolean;
1626
+ hasKeyboardSupport: boolean;
1627
+ ariaAttributes: Record<string, string>;
1628
+ landmarks: number;
1629
+ headingStructure: string[];
1630
+ }
1631
+ export interface MockNextNavigationOptions {
1632
+ pathname?: string;
1633
+ searchParams?: Record<string, string | string[]>;
1634
+ push?: ReturnType<typeof Vitest.vi.fn>;
1635
+ replace?: ReturnType<typeof Vitest.vi.fn>;
1636
+ refresh?: ReturnType<typeof Vitest.vi.fn>;
1637
+ back?: ReturnType<typeof Vitest.vi.fn>;
1638
+ forward?: ReturnType<typeof Vitest.vi.fn>;
1639
+ }
1640
+ export interface SRTestOptions {
1641
+ initialProps: Record<string, unknown>;
1642
+ revalidate: number;
1643
+ newProps: Record<string, unknown>;
1644
+ waitTime?: number;
1645
+ }
1646
+ export interface ApiRouteTestScenario {
1647
+ name: string;
1648
+ request: Partial<MockNextApiRequest>;
1649
+ expectedStatus: number;
1650
+ expectedBody?: unknown;
1651
+ expectedHeaders?: Record<string, string>;
1652
+ }
1653
+ export interface ApiMiddlewareTestScenario {
1654
+ name: string;
1655
+ request: Partial<MockNextApiRequest>;
1656
+ shouldCallNext: boolean;
1657
+ modifications?: {
1658
+ request?: Partial<MockNextApiRequest>;
1659
+ response?: Partial<MockNextApiResponse>;
1660
+ };
1661
+ }
1662
+ export interface EventSequenceTracker {
1663
+ record: (event: string) => void;
1664
+ verify: () => void;
1665
+ getRecorded: () => string[];
1666
+ reset: () => void;
1667
+ }
1668
+ export interface ApiAuthScenario {
1669
+ name: string;
1670
+ headers?: Record<string, string>;
1671
+ cookies?: Record<string, string>;
1672
+ expectedStatus: number;
1673
+ expectedMessage?: string;
1674
+ }
1675
+ export interface ApiRouteOptions {
1676
+ method?: string;
1677
+ url?: string;
1678
+ headers?: Record<string, string | string[]>;
1679
+ query?: Record<string, string | string[]>;
1680
+ body?: unknown;
1681
+ cookies?: Record<string, string>;
1682
+ }
1683
+ export interface ServerComponentTestScenario {
1684
+ name: string;
1685
+ props: Record<string, unknown>;
1686
+ searchParams?: Record<string, string>;
1687
+ params?: Record<string, string>;
1688
+ expectedContent?: string | RegExp;
1689
+ }
1690
+ export interface MiddlewareMatcherConfig {
1691
+ matcher: string | string[];
1692
+ }
1693
+ export interface MockNextNavigationResult {
1694
+ navigation: {
1695
+ push: ReturnType<typeof Vitest.vi.fn>;
1696
+ replace: ReturnType<typeof Vitest.vi.fn>;
1697
+ refresh: ReturnType<typeof Vitest.vi.fn>;
1698
+ back: ReturnType<typeof Vitest.vi.fn>;
1699
+ forward: ReturnType<typeof Vitest.vi.fn>;
1700
+ };
1701
+ restore: () => void;
1702
+ }
1703
+ export interface TestHarnessOptions<TOptions> {
1704
+ create: (deps: Map<unknown, unknown>, opts: TOptions) => unknown;
1705
+ dependencies?: Array<TestDependency>;
1706
+ }
1707
+ export interface TestHarnessResult<T> {
1708
+ instance: T;
1709
+ dependencies: Map<unknown, unknown>;
1710
+ logger?: unknown;
1711
+ getDependency: <U>(token: unknown) => U;
1712
+ }
1713
+ export interface ConsoleMockOptions {
1714
+ suppressAll?: boolean;
1715
+ suppress?: Array<'log' | 'error' | 'warn' | 'info' | 'debug'>;
1716
+ }
1717
+ export type ConsoleMethod = 'log' | 'error' | 'warn' | 'info' | 'debug';
1718
+ export interface HookErrorResult {
1719
+ error?: {
1720
+ message: string;
1721
+ };
1722
+ }
1723
+ export interface ComponentWithLoading {
1724
+ isLoading?: boolean;
1725
+ [key: string]: unknown;
1726
+ }
1727
+ export interface ConditionalRenderingTest {
1728
+ props: Record<string, unknown>;
1729
+ shouldRender: string[];
1730
+ shouldNotRender: string[];
1731
+ }
1732
+ export interface ProviderConfig {
1733
+ Provider: React.ComponentType<{
1734
+ children: React.ReactNode;
1735
+ [key: string]: unknown;
1736
+ }>;
1737
+ props?: Record<string, unknown>;
1738
+ }
1739
+ export interface UserInteractionTest {
1740
+ name: string;
1741
+ action: (user: unknown) => Promise<void>;
1742
+ expectation: () => void;
1743
+ }
1744
+ export interface ErrorBoundaryTest {
1745
+ error: Error;
1746
+ expectedMessage?: string;
1747
+ shouldHaveReset?: boolean;
1748
+ }
1749
+ export interface ComponentTestSuiteResult {
1750
+ testRendering: () => void;
1751
+ testUserInteractions: (interactions: Array<UserInteractionTest>) => void;
1752
+ testProps: (propVariations: Array<PropVariation>) => void;
1753
+ }
1754
+ export interface ResourceCleanupTest {
1755
+ name: string;
1756
+ create: () => unknown;
1757
+ cleanup: (resource: unknown) => Promise<void> | void;
1758
+ isCleanedUp: (resource: unknown) => boolean;
1759
+ }
1760
+ export interface DependencyInjectionContainer {
1761
+ register: (token: unknown, factory: () => unknown, options: {
1762
+ lifecycle: 'singleton' | 'transient' | 'scoped';
1763
+ dependencies?: unknown[];
1764
+ }) => void;
1765
+ resolve: (token: unknown) => unknown;
1766
+ dispose: () => Promise<void>;
1767
+ }
1768
+ export interface DependencyInjectionConfig {
1769
+ token: unknown;
1770
+ factory: () => unknown;
1771
+ dependencies?: unknown[];
1772
+ lifecycle: 'singleton' | 'transient' | 'scoped';
1773
+ cleanup?: (instance: unknown) => void;
1774
+ }
1775
+ export interface AsyncLifecycleHook {
1776
+ name: string;
1777
+ method: string;
1778
+ timeout?: number;
1779
+ shouldReject?: boolean;
1780
+ expectedError?: string | RegExp;
1781
+ }
1782
+ export interface LifecycleTestHarnessResult<T> {
1783
+ instance: T;
1784
+ getHooks: () => Array<LifecycleHookRecord>;
1785
+ clearHooks: () => void;
1786
+ getHooksByPhase: (phase: string) => Array<LifecycleHookRecord>;
1787
+ getLastHook: () => LifecycleHookRecord | undefined;
1788
+ expectHookCalled: (method: string) => void;
1789
+ expectHookOrder: (expectedOrder: string[]) => void;
1790
+ }
1791
+ export interface GracefulShutdownOptions {
1792
+ shutdownTimeout?: number;
1793
+ signals?: globalThis.NodeJS.Signals[];
1794
+ expectedCleanupActions?: string[];
1795
+ }
1796
+ export interface HookCleanupFunction {
1797
+ unmount: () => void;
1798
+ }
1799
+ export interface MockIntersectionObserverEntry {
1800
+ target: Element;
1801
+ isIntersecting: boolean;
1802
+ intersectionRatio: number;
1803
+ boundingClientRect: DOMRect;
1804
+ }
1805
+ export type ConfigObject = Record<string, unknown>;
1806
+ export type ConfigLoader = (env: string) => unknown;
1807
+ export type EnvironmentTransformer = (env: EnvironmentConfig) => ConfigObject;
1808
+ export type KeyboardUserInteraction = Pick<UserInteraction, 'keyboard'>;
1809
+ export type FocusUserInteraction = Required<Pick<UserInteraction, 'keyboard' | 'tab'>>;
1810
+ export type SkipLinkUserInteraction = Required<Pick<UserInteraction, 'click' | 'tab'>>;
1811
+ export type AccessibilityAttributesMap = Record<string, string>;
1812
+ export type TestParameters = Record<string, unknown>;
1813
+ export type TestMatrixInputs<T extends Record<string, unknown[]>> = {
1814
+ [K in keyof T]: T[K][];
1815
+ };
1816
+ export type TestMatrixCombination<T extends Record<string, unknown[]>> = {
1817
+ [K in keyof T]: T[K][number];
1818
+ };
1819
+ export type PartialTestMatrixCombination<T extends Record<string, unknown[]>> = Partial<{
1820
+ [K in keyof T]: T[K][number];
1821
+ }>;
1822
+ export type PropertyTestFunction<T> = (value: T) => boolean | Promise<boolean>;
1823
+ export type StateTransitionApplyFunction<TState, TAction> = (state: TState, action: TAction) => TState;
1824
+ export type CombinationTestFunction<T extends Record<string, unknown[]>> = (combination: TestCombination<T>) => void | Promise<void>;
1825
+ export type UnknownFunction = (...args: unknown[]) => unknown;
1826
+ export interface SpyTargetConfig {
1827
+ obj: UnknownRecord;
1828
+ method: string;
1829
+ implementation?: UnknownFunction;
1830
+ }
1831
+ export type ModuleMockFactories = Record<string, () => UnknownRecord>;
1832
+ export interface TestCaseWithSetup<T> {
1833
+ name: string;
1834
+ args: unknown[];
1835
+ expected: unknown;
1836
+ setup?: (instance: T) => void;
1837
+ }
1838
+ export interface LifecycleHookTestConfig<T> {
1839
+ name: string;
1840
+ hook: keyof T;
1841
+ expectedCalls?: number;
1842
+ expectError?: boolean;
1843
+ }
1844
+ export interface ErrorHandlingScenario<T> {
1845
+ method: keyof T;
1846
+ args: unknown[];
1847
+ expectedError: string | RegExp | typeof Error;
1848
+ setup?: (instance: T) => void;
1849
+ }
1850
+ export type VoidFunction = () => void;
1851
+ export type ValueHandler<T> = (value: T) => void;
1852
+ export type ErrorHandler = (error: unknown) => void;
1853
+ export type DataHandler<T> = (data: T) => void;
1854
+ export type ValueGetter<T> = () => T;
1855
+ export type GenericArgsFunction<T> = (...args: unknown[]) => T;
1856
+ export type AsyncFunction<T> = () => Promise<T>;
1857
+ export interface OriginalConsole {
1858
+ log: typeof globalThis.console.log;
1859
+ error: typeof globalThis.console.error;
1860
+ warn: typeof globalThis.console.warn;
1861
+ info: typeof globalThis.console.info;
1862
+ debug: typeof globalThis.console.debug;
1863
+ }
1864
+ export interface ElementInfo {
1865
+ tagName: string;
1866
+ id: string;
1867
+ className: string;
1868
+ textContent: string | null;
1869
+ attributes: Record<string, string>;
1870
+ }
1871
+ export interface DebouncedFunction<T extends (...args: unknown[]) => unknown> extends Function {
1872
+ (...args: Parameters<T>): void;
1873
+ cancel: () => void;
1874
+ flush: () => void;
1875
+ }
1876
+ export interface ThrottledFunction<T extends (...args: unknown[]) => unknown> extends Function {
1877
+ (...args: Parameters<T>): void;
1878
+ cancel: () => void;
1879
+ }
1880
+ export interface Stopwatch {
1881
+ start(): void;
1882
+ lap(): number;
1883
+ stop(): number;
1884
+ getLaps(): number[];
1885
+ reset(): void;
1886
+ }
1887
+ export interface ControllerTestHarnessReturn<T> {
1888
+ controller: T;
1889
+ moduleRef: {
1890
+ get: <U>(token: unknown) => U;
1891
+ };
1892
+ logger?: unknown;
1893
+ }
1894
+ export interface ServiceTestHarnessReturn<T> {
1895
+ service: T;
1896
+ dependencies: Map<unknown, unknown>;
1897
+ logger?: unknown;
1898
+ resetMocks: () => void;
1899
+ expectCalled: (method: keyof T, times?: number) => void;
1900
+ expectCalledWith: (method: keyof T, ...args: unknown[]) => void;
1901
+ }
1902
+ export interface DynamicModuleClass {
1903
+ forRoot: (config: unknown) => Record<string, unknown>;
1904
+ }
1905
+ export interface DynamicModuleExpectations {
1906
+ providers?: unknown[];
1907
+ imports?: unknown[];
1908
+ exports?: unknown[];
1909
+ }
1910
+ export interface NestJSTestSuiteSetupReturn {
1911
+ module: unknown;
1912
+ providers: Map<unknown, unknown>;
1913
+ }
1914
+ export interface ProviderInjectionTest {
1915
+ token: unknown;
1916
+ dependencies: unknown[];
1917
+ testFn: (instance: unknown, deps: unknown[]) => void;
1918
+ }
1919
+ export interface WebSocketPingMessage {
1920
+ type: 'ping';
1921
+ }
1922
+ export interface WebSocketPongMessage {
1923
+ type: 'pong';
1924
+ }
1925
+ export interface WebSocketEchoMessage {
1926
+ type: 'echo';
1927
+ data: string;
1928
+ }
1929
+ export interface WebSocketTypedMessage {
1930
+ type: string;
1931
+ data: string;
1932
+ }
1933
+ export interface ImageLoaderInput {
1934
+ src: string;
1935
+ width: number;
1936
+ quality?: number;
1937
+ }
1938
+ export interface UserFlowStep {
1939
+ name: string;
1940
+ interactions: InteractionSequence[];
1941
+ assertions: () => void | Promise<void>;
1942
+ navigation?: {
1943
+ expectedUrl?: string;
1944
+ waitForNavigation?: boolean;
1945
+ };
1946
+ }
1947
+ export interface MockNextRequestCreatorParams {
1948
+ url: string;
1949
+ options?: {
1950
+ method?: string;
1951
+ headers?: Record<string, string>;
1952
+ body?: unknown;
1953
+ searchParams?: Record<string, string>;
1954
+ };
1955
+ }
1956
+ export interface ProviderInjection {
1957
+ token: unknown;
1958
+ dependencies: unknown[];
1959
+ testFn: (instance: unknown, deps: unknown[]) => void;
1960
+ }
1961
+ export interface CreateMockRedisClientMock {
1962
+ set: Vitest.Mock;
1963
+ get: Vitest.Mock;
1964
+ del: Vitest.Mock;
1965
+ keys: Vitest.Mock;
1966
+ quit: Vitest.Mock;
1967
+ on: Vitest.Mock;
1968
+ multi: Vitest.Mock;
1969
+ ping: Vitest.Mock;
1970
+ }