@plyaz/types 1.4.0 → 1.5.0
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.
- package/dist/features/community/blog/index.d.ts +2 -0
- package/dist/features/community/blog/providers/index.d.ts +1 -0
- package/dist/features/community/blog/providers/wordpress/index.d.ts +1 -0
- package/dist/features/community/blog/providers/wordpress/types.d.ts +36 -0
- package/dist/features/community/blog/types.d.ts +35 -0
- package/dist/features/community/index.d.ts +1 -1
- package/dist/testing/common/factories/types.d.ts +78 -34
- package/dist/testing/common/mocks/types.d.ts +456 -202
- package/dist/testing/common/patterns/types.d.ts +19 -2
- package/dist/testing/common/utils/types.d.ts +1221 -31
- package/dist/testing/features/cache/types.d.ts +129 -1
- package/dist/testing/features/feature-flags/types.d.ts +203 -41
- package/package.json +1 -1
- package/dist/features/community/types.d.ts +0 -23
|
@@ -271,7 +271,7 @@ export interface RetryOptions {
|
|
|
271
271
|
*/
|
|
272
272
|
export interface MockAsync<T = void> {
|
|
273
273
|
/** The mock function that returns promises */
|
|
274
|
-
mock: Vitest.
|
|
274
|
+
mock: Vitest.MockInstance;
|
|
275
275
|
/** Resolve the next pending promise with a value */
|
|
276
276
|
resolve: (value: T) => void;
|
|
277
277
|
/** Reject the next pending promise with an error */
|
|
@@ -561,11 +561,11 @@ export interface TestCleanup {
|
|
|
561
561
|
clear: () => void;
|
|
562
562
|
}
|
|
563
563
|
export interface MockConsole {
|
|
564
|
-
log: Vitest.
|
|
565
|
-
error: Vitest.
|
|
566
|
-
warn: Vitest.
|
|
567
|
-
info: Vitest.
|
|
568
|
-
debug: Vitest.
|
|
564
|
+
log: Vitest.MockInstance;
|
|
565
|
+
error: Vitest.MockInstance;
|
|
566
|
+
warn: Vitest.MockInstance;
|
|
567
|
+
info: Vitest.MockInstance;
|
|
568
|
+
debug: Vitest.MockInstance;
|
|
569
569
|
restore: () => void;
|
|
570
570
|
}
|
|
571
571
|
export interface MockEnv {
|
|
@@ -793,12 +793,14 @@ export interface ThrottleResult {
|
|
|
793
793
|
called: boolean;
|
|
794
794
|
args?: unknown[];
|
|
795
795
|
}
|
|
796
|
-
export interface AsyncScenario<T> {
|
|
796
|
+
export interface AsyncScenario<T = void> {
|
|
797
797
|
name: string;
|
|
798
798
|
setup: () => Promise<void>;
|
|
799
799
|
action: () => Promise<T>;
|
|
800
800
|
verify: (result: T) => void | Promise<void>;
|
|
801
801
|
cleanup?: () => Promise<void>;
|
|
802
|
+
/** Expected hooks */
|
|
803
|
+
expectedHooks: string[];
|
|
802
804
|
}
|
|
803
805
|
export interface WaitForChangeOptions<T> {
|
|
804
806
|
timeout?: number;
|
|
@@ -1147,10 +1149,10 @@ export interface MockCallResult {
|
|
|
1147
1149
|
error?: unknown;
|
|
1148
1150
|
}
|
|
1149
1151
|
export interface FileWatcher extends MockEventEmitter {
|
|
1150
|
-
add: Vitest.
|
|
1151
|
-
unwatch: Vitest.
|
|
1152
|
-
close: Vitest.
|
|
1153
|
-
getWatched: Vitest.
|
|
1152
|
+
add: Vitest.MockInstance;
|
|
1153
|
+
unwatch: Vitest.MockInstance;
|
|
1154
|
+
close: Vitest.MockInstance;
|
|
1155
|
+
getWatched: Vitest.MockInstance;
|
|
1154
1156
|
simulateChange: (path: string) => void;
|
|
1155
1157
|
simulateAdd: (path: string) => void;
|
|
1156
1158
|
simulateUnlink: (path: string) => void;
|
|
@@ -1195,9 +1197,9 @@ export interface MockNextRequest {
|
|
|
1195
1197
|
href: string;
|
|
1196
1198
|
};
|
|
1197
1199
|
cookies: {
|
|
1198
|
-
get: Vitest.
|
|
1199
|
-
set: Vitest.
|
|
1200
|
-
delete: Vitest.
|
|
1200
|
+
get: Vitest.MockInstance;
|
|
1201
|
+
set: Vitest.MockInstance;
|
|
1202
|
+
delete: Vitest.MockInstance;
|
|
1201
1203
|
};
|
|
1202
1204
|
geo: {
|
|
1203
1205
|
city: string;
|
|
@@ -1209,24 +1211,24 @@ export interface MockNextRequest {
|
|
|
1209
1211
|
}
|
|
1210
1212
|
export interface MockNextResponse {
|
|
1211
1213
|
cookies: {
|
|
1212
|
-
set: Vitest.
|
|
1213
|
-
delete: Vitest.
|
|
1214
|
+
set: Vitest.MockInstance;
|
|
1215
|
+
delete: Vitest.MockInstance;
|
|
1214
1216
|
};
|
|
1215
1217
|
headers: Headers;
|
|
1216
1218
|
status: number;
|
|
1217
|
-
redirect: Vitest.
|
|
1218
|
-
rewrite: Vitest.
|
|
1219
|
-
next: Vitest.
|
|
1220
|
-
json: Vitest.
|
|
1219
|
+
redirect: Vitest.MockInstance;
|
|
1220
|
+
rewrite: Vitest.MockInstance;
|
|
1221
|
+
next: Vitest.MockInstance;
|
|
1222
|
+
json: Vitest.MockInstance;
|
|
1221
1223
|
}
|
|
1222
1224
|
export interface MockWebSocketServer extends MockEventEmitter {
|
|
1223
1225
|
clients: Set<CreateMockWebSocketReturn>;
|
|
1224
1226
|
port: number;
|
|
1225
1227
|
host: string;
|
|
1226
1228
|
maxClients: number;
|
|
1227
|
-
handleUpgrade: Vitest.
|
|
1228
|
-
shouldHandle: Vitest.
|
|
1229
|
-
close: Vitest.
|
|
1229
|
+
handleUpgrade: Vitest.MockInstance;
|
|
1230
|
+
shouldHandle: Vitest.MockInstance;
|
|
1231
|
+
close: Vitest.MockInstance;
|
|
1230
1232
|
addClient: (client: CreateMockWebSocketReturn) => void;
|
|
1231
1233
|
removeClient: (client: CreateMockWebSocketReturn) => void;
|
|
1232
1234
|
simulateConnection: (clientId?: string) => CreateMockWebSocketReturn;
|
|
@@ -1959,12 +1961,1200 @@ export interface ProviderInjection {
|
|
|
1959
1961
|
testFn: (instance: unknown, deps: unknown[]) => void;
|
|
1960
1962
|
}
|
|
1961
1963
|
export interface CreateMockRedisClientMock {
|
|
1962
|
-
set: Vitest.
|
|
1963
|
-
get: Vitest.
|
|
1964
|
-
del: Vitest.
|
|
1965
|
-
keys: Vitest.
|
|
1966
|
-
quit: Vitest.
|
|
1967
|
-
on: Vitest.
|
|
1968
|
-
multi: Vitest.
|
|
1969
|
-
ping: Vitest.
|
|
1964
|
+
set: Vitest.MockInstance;
|
|
1965
|
+
get: Vitest.MockInstance;
|
|
1966
|
+
del: Vitest.MockInstance;
|
|
1967
|
+
keys: Vitest.MockInstance;
|
|
1968
|
+
quit: Vitest.MockInstance;
|
|
1969
|
+
on: Vitest.MockInstance;
|
|
1970
|
+
multi: Vitest.MockInstance;
|
|
1971
|
+
ping: Vitest.MockInstance;
|
|
1972
|
+
}
|
|
1973
|
+
/**
|
|
1974
|
+
* Call tracker interface
|
|
1975
|
+
* @interface CallTracker
|
|
1976
|
+
*/
|
|
1977
|
+
export interface CallTracker {
|
|
1978
|
+
/** Track function call */
|
|
1979
|
+
trackCall: (name: string, args: unknown[]) => void;
|
|
1980
|
+
/** Get calls */
|
|
1981
|
+
getCalls: (name?: string) => Array<{
|
|
1982
|
+
name: string;
|
|
1983
|
+
args: unknown[];
|
|
1984
|
+
timestamp: number;
|
|
1985
|
+
}>;
|
|
1986
|
+
/** Reset tracker */
|
|
1987
|
+
reset: () => void;
|
|
1988
|
+
}
|
|
1989
|
+
/**
|
|
1990
|
+
* Tracked spy with additional properties
|
|
1991
|
+
* @interface TrackedSpy
|
|
1992
|
+
* @extends SpyInstance from @plyaz/types/testing
|
|
1993
|
+
*/
|
|
1994
|
+
export interface TrackedSpy extends SpyInstance {
|
|
1995
|
+
/** Get call count */
|
|
1996
|
+
getCallCount: () => number;
|
|
1997
|
+
/** Get call history */
|
|
1998
|
+
getCallHistory: () => Array<{
|
|
1999
|
+
args: unknown[];
|
|
2000
|
+
result?: unknown;
|
|
2001
|
+
error?: unknown;
|
|
2002
|
+
}>;
|
|
2003
|
+
}
|
|
2004
|
+
/**
|
|
2005
|
+
* Spy map type
|
|
2006
|
+
* @typeParam T - Type to map to spies
|
|
2007
|
+
*/
|
|
2008
|
+
export type SpyMap<T> = {
|
|
2009
|
+
[K in keyof T]: SpyInstance;
|
|
2010
|
+
};
|
|
2011
|
+
/**
|
|
2012
|
+
* Tracked data interface
|
|
2013
|
+
* @interface TrackedData
|
|
2014
|
+
* @typeParam T - Type of tracked data
|
|
2015
|
+
*/
|
|
2016
|
+
export interface TrackedData<T> {
|
|
2017
|
+
/** Data being tracked */
|
|
2018
|
+
data: T;
|
|
2019
|
+
/** Access history */
|
|
2020
|
+
accesses: Array<{
|
|
2021
|
+
property: string | symbol;
|
|
2022
|
+
timestamp: number;
|
|
2023
|
+
}>;
|
|
2024
|
+
}
|
|
2025
|
+
/**
|
|
2026
|
+
* Access information
|
|
2027
|
+
* @interface AccessInfo
|
|
2028
|
+
*/
|
|
2029
|
+
export interface AccessInfo {
|
|
2030
|
+
/** Property being accessed */
|
|
2031
|
+
property: string | symbol;
|
|
2032
|
+
/** Access timestamp */
|
|
2033
|
+
timestamp: number;
|
|
2034
|
+
/** Access count */
|
|
2035
|
+
count: number;
|
|
2036
|
+
}
|
|
2037
|
+
/**
|
|
2038
|
+
* Worker-like interface for various worker types
|
|
2039
|
+
* @interface WorkerLike
|
|
2040
|
+
*/
|
|
2041
|
+
export interface WorkerLike {
|
|
2042
|
+
/** Error handler */
|
|
2043
|
+
onError?: (error: Error) => void;
|
|
2044
|
+
/** Error event handler */
|
|
2045
|
+
onerror?: (error: Error | ErrorEvent) => void;
|
|
2046
|
+
/** Event emitter */
|
|
2047
|
+
emit?: (event: string, data: unknown) => void;
|
|
2048
|
+
/** Post message */
|
|
2049
|
+
postMessage?: (message: unknown) => void;
|
|
2050
|
+
/** Event listener */
|
|
2051
|
+
on?: {
|
|
2052
|
+
(event: 'message', handler: (data: unknown) => void): void;
|
|
2053
|
+
(event: 'error', handler: (error: unknown) => void): void;
|
|
2054
|
+
(event: string, handler: (data: unknown) => void): void;
|
|
2055
|
+
};
|
|
2056
|
+
/** Add event listener */
|
|
2057
|
+
addEventListener?: {
|
|
2058
|
+
(event: 'message', handler: (event: MessageEvent) => void): void;
|
|
2059
|
+
(event: 'error', handler: (event: ErrorEvent) => void): void;
|
|
2060
|
+
(event: string, handler: (event: Event) => void): void;
|
|
2061
|
+
};
|
|
2062
|
+
/** Message handler */
|
|
2063
|
+
onmessage?: (event: MessageEvent) => void;
|
|
2064
|
+
/** Terminate worker */
|
|
2065
|
+
terminate?: () => void;
|
|
2066
|
+
}
|
|
2067
|
+
/**
|
|
2068
|
+
* Worker pool interface
|
|
2069
|
+
* @interface WorkerPool
|
|
2070
|
+
*/
|
|
2071
|
+
export interface WorkerPool {
|
|
2072
|
+
/** Add task to pool */
|
|
2073
|
+
addTask: (task: () => Promise<void>) => void;
|
|
2074
|
+
/** Start pool */
|
|
2075
|
+
start: () => Promise<void>;
|
|
2076
|
+
/** Stop pool */
|
|
2077
|
+
stop: () => void;
|
|
2078
|
+
/** Wait for completion */
|
|
2079
|
+
waitForCompletion: () => Promise<void>;
|
|
2080
|
+
/** Get pool statistics */
|
|
2081
|
+
getStats: () => {
|
|
2082
|
+
totalWorkers: number;
|
|
2083
|
+
busyWorkers: number;
|
|
2084
|
+
idleWorkers: number;
|
|
2085
|
+
tasksCompleted: number;
|
|
2086
|
+
tasksFailed: number;
|
|
2087
|
+
tasksRemaining: number;
|
|
2088
|
+
workerStats: Array<{
|
|
2089
|
+
id: number;
|
|
2090
|
+
busy: boolean;
|
|
2091
|
+
taskCount: number;
|
|
2092
|
+
}>;
|
|
2093
|
+
};
|
|
2094
|
+
}
|
|
2095
|
+
/**
|
|
2096
|
+
* Worker metrics interface
|
|
2097
|
+
* @interface WorkerMetrics
|
|
2098
|
+
*/
|
|
2099
|
+
export interface WorkerMetrics {
|
|
2100
|
+
/** Worker ID */
|
|
2101
|
+
workerId: number;
|
|
2102
|
+
/** Task count */
|
|
2103
|
+
taskCount: number;
|
|
2104
|
+
/** Execution time */
|
|
2105
|
+
executionTime: number;
|
|
2106
|
+
/** Errors encountered */
|
|
2107
|
+
errors: Error[];
|
|
2108
|
+
/** Throughput */
|
|
2109
|
+
throughput: number;
|
|
2110
|
+
/** Average task time */
|
|
2111
|
+
avgTaskTime?: number;
|
|
2112
|
+
/** Memory usage */
|
|
2113
|
+
memoryUsage?: number;
|
|
2114
|
+
/** CPU usage */
|
|
2115
|
+
cpuUsage?: number;
|
|
2116
|
+
}
|
|
2117
|
+
/**
|
|
2118
|
+
* Worker test harness interface
|
|
2119
|
+
* @interface WorkerTestHarness
|
|
2120
|
+
*/
|
|
2121
|
+
export interface WorkerTestHarness {
|
|
2122
|
+
/** Run test scenario */
|
|
2123
|
+
run: () => Promise<{
|
|
2124
|
+
metrics: WorkerMetrics[];
|
|
2125
|
+
totalExecutionTime: number;
|
|
2126
|
+
totalTasks: number;
|
|
2127
|
+
totalErrors: number;
|
|
2128
|
+
}>;
|
|
2129
|
+
/** Assert test results */
|
|
2130
|
+
assertResults: (results: {
|
|
2131
|
+
metrics: WorkerMetrics[];
|
|
2132
|
+
totalExecutionTime: number;
|
|
2133
|
+
totalTasks: number;
|
|
2134
|
+
totalErrors: number;
|
|
2135
|
+
}) => void;
|
|
2136
|
+
/** Get aggregated metrics */
|
|
2137
|
+
getMetrics: () => {
|
|
2138
|
+
workerCount: number;
|
|
2139
|
+
totalTasks: number;
|
|
2140
|
+
avgExecutionTime: number;
|
|
2141
|
+
avgThroughput: number;
|
|
2142
|
+
errorCount: number;
|
|
2143
|
+
workerMetrics: WorkerMetrics[];
|
|
2144
|
+
};
|
|
2145
|
+
}
|
|
2146
|
+
/**
|
|
2147
|
+
* Worker spy interface
|
|
2148
|
+
* @interface WorkerSpy
|
|
2149
|
+
*/
|
|
2150
|
+
export interface WorkerSpy {
|
|
2151
|
+
/** Get messages sent */
|
|
2152
|
+
getMessagesSent: () => unknown[];
|
|
2153
|
+
/** Get messages received */
|
|
2154
|
+
getMessagesReceived: () => unknown[];
|
|
2155
|
+
/** Get errors */
|
|
2156
|
+
getErrors: () => Error[];
|
|
2157
|
+
/** Check if terminated */
|
|
2158
|
+
isTerminated: () => boolean;
|
|
2159
|
+
/** Simulate message */
|
|
2160
|
+
simulateMessage: (message: unknown) => void;
|
|
2161
|
+
/** Simulate error */
|
|
2162
|
+
simulateError: (error: Error) => void;
|
|
2163
|
+
/** Reset spy */
|
|
2164
|
+
reset: () => void;
|
|
2165
|
+
}
|
|
2166
|
+
/**
|
|
2167
|
+
* Performance profiling options
|
|
2168
|
+
* @interface ProfileOptions
|
|
2169
|
+
*/
|
|
2170
|
+
export interface ProfileOptions {
|
|
2171
|
+
/** Sample interval in milliseconds */
|
|
2172
|
+
sampleInterval?: number;
|
|
2173
|
+
/** Include memory profiling */
|
|
2174
|
+
includeMemory?: boolean;
|
|
2175
|
+
/** Include CPU profiling */
|
|
2176
|
+
includeCPU?: boolean;
|
|
2177
|
+
}
|
|
2178
|
+
/**
|
|
2179
|
+
* Performance profile result
|
|
2180
|
+
* @interface ProfileResult
|
|
2181
|
+
* @typeParam T - Type of profiled operation result
|
|
2182
|
+
*/
|
|
2183
|
+
export interface ProfileResult<T> {
|
|
2184
|
+
/** Operation result */
|
|
2185
|
+
result: T;
|
|
2186
|
+
/** CPU profile data */
|
|
2187
|
+
cpuProfile?: {
|
|
2188
|
+
/** Profile samples */
|
|
2189
|
+
samples: number[];
|
|
2190
|
+
/** Sample timestamps */
|
|
2191
|
+
timestamps: number[];
|
|
2192
|
+
};
|
|
2193
|
+
/** Memory profile data */
|
|
2194
|
+
memoryProfile?: {
|
|
2195
|
+
/** Memory usage samples */
|
|
2196
|
+
samples: number[];
|
|
2197
|
+
/** Memory timestamps */
|
|
2198
|
+
timestamps: number[];
|
|
2199
|
+
};
|
|
2200
|
+
}
|
|
2201
|
+
/**
|
|
2202
|
+
* Stress testing options
|
|
2203
|
+
* @interface StressTestOptions
|
|
2204
|
+
*/
|
|
2205
|
+
export interface StressTestOptions {
|
|
2206
|
+
/** Test duration in milliseconds */
|
|
2207
|
+
duration?: number;
|
|
2208
|
+
/** Number of concurrent operations */
|
|
2209
|
+
concurrency?: number;
|
|
2210
|
+
/** Ramp-up time */
|
|
2211
|
+
rampUp?: number;
|
|
2212
|
+
/** Operation rate limit */
|
|
2213
|
+
rate?: number;
|
|
2214
|
+
}
|
|
2215
|
+
/**
|
|
2216
|
+
* Stress test result
|
|
2217
|
+
* @interface StressTestResult
|
|
2218
|
+
*/
|
|
2219
|
+
export interface StressTestResult {
|
|
2220
|
+
/** Total operations performed */
|
|
2221
|
+
totalOperations: number;
|
|
2222
|
+
/** Successful operations */
|
|
2223
|
+
successfulOperations: number;
|
|
2224
|
+
/** Failed operations */
|
|
2225
|
+
failedOperations: number;
|
|
2226
|
+
/** Average response time */
|
|
2227
|
+
averageResponseTime: number;
|
|
2228
|
+
/** Error details */
|
|
2229
|
+
errors: Error[];
|
|
2230
|
+
}
|
|
2231
|
+
/**
|
|
2232
|
+
* Throughput test result
|
|
2233
|
+
* @interface ThroughputResult
|
|
2234
|
+
*/
|
|
2235
|
+
export interface ThroughputResult {
|
|
2236
|
+
/** Operations completed */
|
|
2237
|
+
operationsCompleted: number;
|
|
2238
|
+
/** Test duration */
|
|
2239
|
+
duration: number;
|
|
2240
|
+
/** Throughput rate */
|
|
2241
|
+
throughput: number;
|
|
2242
|
+
/** Peak throughput */
|
|
2243
|
+
peakThroughput: number;
|
|
2244
|
+
}
|
|
2245
|
+
/**
|
|
2246
|
+
* Performance monitoring options
|
|
2247
|
+
* @interface MonitorOptions
|
|
2248
|
+
*/
|
|
2249
|
+
export interface MonitorOptions {
|
|
2250
|
+
/** Monitoring interval */
|
|
2251
|
+
interval?: number;
|
|
2252
|
+
/** Metrics to collect */
|
|
2253
|
+
metrics?: Array<'cpu' | 'memory' | 'time'>;
|
|
2254
|
+
}
|
|
2255
|
+
/**
|
|
2256
|
+
* Performance monitor interface
|
|
2257
|
+
* @interface PerformanceMonitor
|
|
2258
|
+
*/
|
|
2259
|
+
export interface PerformanceMonitor {
|
|
2260
|
+
/** Start monitoring */
|
|
2261
|
+
start: () => void;
|
|
2262
|
+
/** Stop monitoring */
|
|
2263
|
+
stop: () => void;
|
|
2264
|
+
/** Get collected metrics */
|
|
2265
|
+
getMetrics: () => {
|
|
2266
|
+
/** CPU metrics */
|
|
2267
|
+
cpu: number[];
|
|
2268
|
+
/** Memory metrics */
|
|
2269
|
+
memory: number[];
|
|
2270
|
+
/** Time metrics */
|
|
2271
|
+
time: number[];
|
|
2272
|
+
};
|
|
2273
|
+
}
|
|
2274
|
+
/**
|
|
2275
|
+
* Memory leak testing options
|
|
2276
|
+
* @interface LeakOptions
|
|
2277
|
+
*/
|
|
2278
|
+
export interface LeakOptions {
|
|
2279
|
+
/** Number of test iterations */
|
|
2280
|
+
iterations?: number;
|
|
2281
|
+
/** Memory threshold */
|
|
2282
|
+
threshold?: number;
|
|
2283
|
+
/** Run GC between runs */
|
|
2284
|
+
gcBetweenRuns?: boolean;
|
|
2285
|
+
}
|
|
2286
|
+
/**
|
|
2287
|
+
* Memory leak test result
|
|
2288
|
+
* @interface LeakResult
|
|
2289
|
+
*/
|
|
2290
|
+
export interface LeakResult {
|
|
2291
|
+
/** Whether leak was detected */
|
|
2292
|
+
hasLeak: boolean;
|
|
2293
|
+
/** Memory growth amount */
|
|
2294
|
+
memoryGrowth: number;
|
|
2295
|
+
/** Memory measurements */
|
|
2296
|
+
measurements: Array<{
|
|
2297
|
+
/** Iteration number */
|
|
2298
|
+
iteration: number;
|
|
2299
|
+
/** Memory usage */
|
|
2300
|
+
memory: number;
|
|
2301
|
+
/** Timestamp */
|
|
2302
|
+
timestamp: number;
|
|
2303
|
+
}>;
|
|
2304
|
+
}
|
|
2305
|
+
/**
|
|
2306
|
+
* Hook testing scenario
|
|
2307
|
+
* @interface HookScenario
|
|
2308
|
+
* @typeParam T - Type of hook result
|
|
2309
|
+
*/
|
|
2310
|
+
export interface HookScenario<T> {
|
|
2311
|
+
/** Scenario name */
|
|
2312
|
+
name: string;
|
|
2313
|
+
/** Initial props */
|
|
2314
|
+
initialProps?: Record<string, unknown>;
|
|
2315
|
+
/** Hook function to test */
|
|
2316
|
+
hook: () => T;
|
|
2317
|
+
/** Expected result */
|
|
2318
|
+
expected: T;
|
|
2319
|
+
/** Setup function */
|
|
2320
|
+
setup?: () => void;
|
|
2321
|
+
/** Cleanup function */
|
|
2322
|
+
cleanup?: () => void;
|
|
2323
|
+
}
|
|
2324
|
+
/**
|
|
2325
|
+
* Context update configuration
|
|
2326
|
+
* @interface ContextUpdate
|
|
2327
|
+
* @typeParam T - Type of context value
|
|
2328
|
+
*/
|
|
2329
|
+
export interface ContextUpdate<T> {
|
|
2330
|
+
/** New context value */
|
|
2331
|
+
value: T;
|
|
2332
|
+
/** Update delay */
|
|
2333
|
+
delay?: number;
|
|
2334
|
+
/** Callback after update */
|
|
2335
|
+
callback?: (value: T) => void;
|
|
2336
|
+
}
|
|
2337
|
+
/**
|
|
2338
|
+
* Suspense testing options
|
|
2339
|
+
* @interface SuspenseOptions
|
|
2340
|
+
*/
|
|
2341
|
+
export interface SuspenseOptions {
|
|
2342
|
+
/** Fallback component */
|
|
2343
|
+
fallback?: React.ReactNode;
|
|
2344
|
+
/** Timeout for suspense */
|
|
2345
|
+
timeout?: number;
|
|
2346
|
+
/** Error boundary */
|
|
2347
|
+
errorBoundary?: boolean;
|
|
2348
|
+
}
|
|
2349
|
+
/**
|
|
2350
|
+
* Concurrent rendering scenario
|
|
2351
|
+
* @interface ConcurrentScenario
|
|
2352
|
+
*/
|
|
2353
|
+
export interface ConcurrentScenario {
|
|
2354
|
+
/** Scenario name */
|
|
2355
|
+
name: string;
|
|
2356
|
+
/** Component to render */
|
|
2357
|
+
component: React.ReactNode;
|
|
2358
|
+
/** Props updates */
|
|
2359
|
+
updates: Array<{
|
|
2360
|
+
/** Props to update */
|
|
2361
|
+
props: Record<string, unknown>;
|
|
2362
|
+
/** Update delay */
|
|
2363
|
+
delay: number;
|
|
2364
|
+
}>;
|
|
2365
|
+
/** Expected renders count */
|
|
2366
|
+
expectedRenders: number;
|
|
2367
|
+
}
|
|
2368
|
+
/**
|
|
2369
|
+
* Accessibility testing options
|
|
2370
|
+
* @interface A11yOptions
|
|
2371
|
+
*/
|
|
2372
|
+
export interface A11yOptions {
|
|
2373
|
+
/** ARIA rules to check */
|
|
2374
|
+
rules?: string[];
|
|
2375
|
+
/** Elements to include */
|
|
2376
|
+
include?: string[];
|
|
2377
|
+
/** Elements to exclude */
|
|
2378
|
+
exclude?: string[];
|
|
2379
|
+
/** Severity levels */
|
|
2380
|
+
level?: 'AA' | 'AAA';
|
|
2381
|
+
/** Tags to test */
|
|
2382
|
+
tags?: string[];
|
|
2383
|
+
}
|
|
2384
|
+
/**
|
|
2385
|
+
* Accessibility violation
|
|
2386
|
+
* @interface A11yViolation
|
|
2387
|
+
*/
|
|
2388
|
+
export interface A11yViolation {
|
|
2389
|
+
/** Rule ID */
|
|
2390
|
+
id: string;
|
|
2391
|
+
/** Violation description */
|
|
2392
|
+
description: string;
|
|
2393
|
+
/** Help text */
|
|
2394
|
+
help: string;
|
|
2395
|
+
/** Help URL */
|
|
2396
|
+
helpUrl: string;
|
|
2397
|
+
/** Impact level */
|
|
2398
|
+
impact: 'minor' | 'moderate' | 'serious' | 'critical';
|
|
2399
|
+
/** Affected nodes */
|
|
2400
|
+
nodes: Array<{
|
|
2401
|
+
/** Element HTML */
|
|
2402
|
+
html: string;
|
|
2403
|
+
/** Element selector */
|
|
2404
|
+
target: string[];
|
|
2405
|
+
/** Failure summary */
|
|
2406
|
+
failureSummary: string;
|
|
2407
|
+
}>;
|
|
2408
|
+
}
|
|
2409
|
+
/**
|
|
2410
|
+
* Accessibility test pass
|
|
2411
|
+
* @interface A11yPass
|
|
2412
|
+
*/
|
|
2413
|
+
export interface A11yPass {
|
|
2414
|
+
/** Rule ID */
|
|
2415
|
+
id: string;
|
|
2416
|
+
/** Rule description */
|
|
2417
|
+
description: string;
|
|
2418
|
+
/** Passed nodes */
|
|
2419
|
+
nodes: Array<{
|
|
2420
|
+
/** Element HTML */
|
|
2421
|
+
html: string;
|
|
2422
|
+
/** Element selector */
|
|
2423
|
+
target: string[];
|
|
2424
|
+
}>;
|
|
2425
|
+
}
|
|
2426
|
+
/**
|
|
2427
|
+
* Incomplete accessibility test
|
|
2428
|
+
* @interface A11yIncomplete
|
|
2429
|
+
*/
|
|
2430
|
+
export interface A11yIncomplete {
|
|
2431
|
+
/** Rule ID */
|
|
2432
|
+
id: string;
|
|
2433
|
+
/** Rule description */
|
|
2434
|
+
description: string;
|
|
2435
|
+
/** Incomplete nodes */
|
|
2436
|
+
nodes: Array<{
|
|
2437
|
+
/** Element HTML */
|
|
2438
|
+
html: string;
|
|
2439
|
+
/** Element selector */
|
|
2440
|
+
target: string[];
|
|
2441
|
+
}>;
|
|
2442
|
+
}
|
|
2443
|
+
/**
|
|
2444
|
+
* Accessibility test report
|
|
2445
|
+
* @interface A11yReport
|
|
2446
|
+
*/
|
|
2447
|
+
export interface A11yReport {
|
|
2448
|
+
/** Violations found */
|
|
2449
|
+
violations: A11yViolation[];
|
|
2450
|
+
/** Tests that passed */
|
|
2451
|
+
passes: A11yPass[];
|
|
2452
|
+
/** Incomplete tests */
|
|
2453
|
+
incomplete: A11yIncomplete[];
|
|
2454
|
+
/** Test URL */
|
|
2455
|
+
url: string;
|
|
2456
|
+
/** Timestamp */
|
|
2457
|
+
timestamp: Date;
|
|
2458
|
+
}
|
|
2459
|
+
/**
|
|
2460
|
+
* Keyboard sequence for testing
|
|
2461
|
+
* @interface KeySequence
|
|
2462
|
+
*/
|
|
2463
|
+
export interface KeySequence {
|
|
2464
|
+
/** Keys to press */
|
|
2465
|
+
keys: string[];
|
|
2466
|
+
/** Delay between keys */
|
|
2467
|
+
delay?: number;
|
|
2468
|
+
/** Modifier keys */
|
|
2469
|
+
modifiers?: Array<'shift' | 'ctrl' | 'alt' | 'meta'>;
|
|
2470
|
+
}
|
|
2471
|
+
/**
|
|
2472
|
+
* Color contrast test result
|
|
2473
|
+
* @interface ContrastResult
|
|
2474
|
+
*/
|
|
2475
|
+
export interface ContrastResult {
|
|
2476
|
+
/** Foreground color */
|
|
2477
|
+
foreground: string;
|
|
2478
|
+
/** Background color */
|
|
2479
|
+
background: string;
|
|
2480
|
+
/** Contrast ratio */
|
|
2481
|
+
ratio: number;
|
|
2482
|
+
/** WCAG AA compliance */
|
|
2483
|
+
AA: boolean;
|
|
2484
|
+
/** WCAG AAA compliance */
|
|
2485
|
+
AAA: boolean;
|
|
2486
|
+
}
|
|
2487
|
+
/**
|
|
2488
|
+
* User session options
|
|
2489
|
+
* @interface SessionOptions
|
|
2490
|
+
*/
|
|
2491
|
+
export interface SessionOptions {
|
|
2492
|
+
/** Pointer events API */
|
|
2493
|
+
pointerEventsCheck?: number;
|
|
2494
|
+
/** Advanced timer */
|
|
2495
|
+
advanceTimers?: () => void;
|
|
2496
|
+
/** Skip hover */
|
|
2497
|
+
skipHover?: boolean;
|
|
2498
|
+
/** Skip click */
|
|
2499
|
+
skipClick?: boolean;
|
|
2500
|
+
/** Auto cleanup */
|
|
2501
|
+
autoCleanup?: boolean;
|
|
2502
|
+
}
|
|
2503
|
+
/**
|
|
2504
|
+
* User event session
|
|
2505
|
+
* @interface UserSession
|
|
2506
|
+
*/
|
|
2507
|
+
export interface UserSession {
|
|
2508
|
+
/** Click element */
|
|
2509
|
+
click: (element: Element, options?: ClickOptions) => Promise<void>;
|
|
2510
|
+
/** Double click element */
|
|
2511
|
+
dblClick: (element: Element, options?: ClickOptions) => Promise<void>;
|
|
2512
|
+
/** Type into element */
|
|
2513
|
+
type: (element: Element, text: string, options?: TypeOptions) => Promise<void>;
|
|
2514
|
+
/** Clear input */
|
|
2515
|
+
clear: (element: Element) => Promise<void>;
|
|
2516
|
+
/** Tab navigation */
|
|
2517
|
+
tab: (options?: {
|
|
2518
|
+
shift?: boolean;
|
|
2519
|
+
}) => Promise<void>;
|
|
2520
|
+
/** Hover element */
|
|
2521
|
+
hover: (element: Element) => Promise<void>;
|
|
2522
|
+
/** Unhover element */
|
|
2523
|
+
unhover: (element: Element) => Promise<void>;
|
|
2524
|
+
}
|
|
2525
|
+
/**
|
|
2526
|
+
* Click options
|
|
2527
|
+
* @interface ClickOptions
|
|
2528
|
+
*/
|
|
2529
|
+
export interface ClickOptions {
|
|
2530
|
+
/** Button to click */
|
|
2531
|
+
button?: 'left' | 'middle' | 'right';
|
|
2532
|
+
/** Click count */
|
|
2533
|
+
clickCount?: number;
|
|
2534
|
+
/** Skip hover */
|
|
2535
|
+
skipHover?: boolean;
|
|
2536
|
+
/** Click delay */
|
|
2537
|
+
delay?: number;
|
|
2538
|
+
}
|
|
2539
|
+
/**
|
|
2540
|
+
* Type options
|
|
2541
|
+
* @interface TypeOptions
|
|
2542
|
+
*/
|
|
2543
|
+
export interface TypeOptions {
|
|
2544
|
+
/** Typing delay */
|
|
2545
|
+
delay?: number;
|
|
2546
|
+
/** Skip click */
|
|
2547
|
+
skipClick?: boolean;
|
|
2548
|
+
/** Skip auto close */
|
|
2549
|
+
skipAutoClose?: boolean;
|
|
2550
|
+
/** Initial selection */
|
|
2551
|
+
initialSelectionStart?: number;
|
|
2552
|
+
/** Initial selection end */
|
|
2553
|
+
initialSelectionEnd?: number;
|
|
2554
|
+
}
|
|
2555
|
+
/**
|
|
2556
|
+
* Drag options
|
|
2557
|
+
* @interface DragOptions
|
|
2558
|
+
*/
|
|
2559
|
+
export interface DragOptions {
|
|
2560
|
+
/** Delta coordinates */
|
|
2561
|
+
delta?: {
|
|
2562
|
+
x: number;
|
|
2563
|
+
y: number;
|
|
2564
|
+
};
|
|
2565
|
+
/** Target element */
|
|
2566
|
+
target?: Element;
|
|
2567
|
+
/** Data transfer */
|
|
2568
|
+
dataTransfer?: {
|
|
2569
|
+
/** Transfer data */
|
|
2570
|
+
getData: (format: string) => string;
|
|
2571
|
+
/** Set transfer data */
|
|
2572
|
+
setData: (format: string, data: string) => void;
|
|
2573
|
+
};
|
|
2574
|
+
}
|
|
2575
|
+
/**
|
|
2576
|
+
* User interaction record
|
|
2577
|
+
* @interface Interaction
|
|
2578
|
+
*/
|
|
2579
|
+
export interface Interaction {
|
|
2580
|
+
/** Interaction type */
|
|
2581
|
+
type: 'click' | 'type' | 'hover' | 'focus' | 'blur';
|
|
2582
|
+
/** Target element */
|
|
2583
|
+
element: Element;
|
|
2584
|
+
/** Interaction data */
|
|
2585
|
+
data?: unknown;
|
|
2586
|
+
/** Timestamp */
|
|
2587
|
+
timestamp: number;
|
|
2588
|
+
}
|
|
2589
|
+
/**
|
|
2590
|
+
* Swipe gesture parameters
|
|
2591
|
+
* @interface SwipeGestureParams
|
|
2592
|
+
*/
|
|
2593
|
+
export interface SwipeGestureParams {
|
|
2594
|
+
/** Start coordinates */
|
|
2595
|
+
start: {
|
|
2596
|
+
x: number;
|
|
2597
|
+
y: number;
|
|
2598
|
+
};
|
|
2599
|
+
/** End coordinates */
|
|
2600
|
+
end: {
|
|
2601
|
+
x: number;
|
|
2602
|
+
y: number;
|
|
2603
|
+
};
|
|
2604
|
+
/** Gesture duration */
|
|
2605
|
+
duration?: number;
|
|
2606
|
+
/** Number of touch points */
|
|
2607
|
+
touches?: number;
|
|
2608
|
+
}
|
|
2609
|
+
/**
|
|
2610
|
+
* Pinch gesture parameters
|
|
2611
|
+
* @interface PinchGestureParams
|
|
2612
|
+
*/
|
|
2613
|
+
export interface PinchGestureParams {
|
|
2614
|
+
/** Center coordinates */
|
|
2615
|
+
center: {
|
|
2616
|
+
x: number;
|
|
2617
|
+
y: number;
|
|
2618
|
+
};
|
|
2619
|
+
/** Scale factor */
|
|
2620
|
+
scale: number;
|
|
2621
|
+
/** Gesture duration */
|
|
2622
|
+
duration?: number;
|
|
2623
|
+
/** Rotation angle */
|
|
2624
|
+
rotation?: number;
|
|
2625
|
+
}
|
|
2626
|
+
/**
|
|
2627
|
+
* Animation frame data
|
|
2628
|
+
* @interface Frame
|
|
2629
|
+
*/
|
|
2630
|
+
export interface Frame {
|
|
2631
|
+
/** Frame timestamp */
|
|
2632
|
+
timestamp: number;
|
|
2633
|
+
/** Frame progress */
|
|
2634
|
+
progress: number;
|
|
2635
|
+
/** Frame values */
|
|
2636
|
+
values: Record<string, number>;
|
|
2637
|
+
}
|
|
2638
|
+
/**
|
|
2639
|
+
* Animation performance metrics
|
|
2640
|
+
* @interface AnimationMetrics
|
|
2641
|
+
*/
|
|
2642
|
+
export interface AnimationMetrics {
|
|
2643
|
+
/** Total duration */
|
|
2644
|
+
duration: number;
|
|
2645
|
+
/** Frame count */
|
|
2646
|
+
frameCount: number;
|
|
2647
|
+
/** Dropped frames */
|
|
2648
|
+
droppedFrames: number;
|
|
2649
|
+
/** Average FPS */
|
|
2650
|
+
averageFPS: number;
|
|
2651
|
+
/** Minimum FPS */
|
|
2652
|
+
minFPS: number;
|
|
2653
|
+
/** Maximum FPS */
|
|
2654
|
+
maxFPS: number;
|
|
2655
|
+
}
|
|
2656
|
+
/**
|
|
2657
|
+
* RequestAnimationFrame options
|
|
2658
|
+
* @interface RAFOptions
|
|
2659
|
+
*/
|
|
2660
|
+
export interface RAFOptions {
|
|
2661
|
+
/** Auto start */
|
|
2662
|
+
autoStart?: boolean;
|
|
2663
|
+
/** Frame limit */
|
|
2664
|
+
frameLimit?: number;
|
|
2665
|
+
/** FPS target */
|
|
2666
|
+
targetFPS?: number;
|
|
2667
|
+
}
|
|
2668
|
+
/**
|
|
2669
|
+
* RequestAnimationFrame mock
|
|
2670
|
+
* @interface RAFMock
|
|
2671
|
+
*/
|
|
2672
|
+
export interface RAFMock {
|
|
2673
|
+
/** Start animation */
|
|
2674
|
+
start: () => void;
|
|
2675
|
+
/** Stop animation */
|
|
2676
|
+
stop: () => void;
|
|
2677
|
+
/** Step to next frame */
|
|
2678
|
+
step: () => void;
|
|
2679
|
+
/** Get current time */
|
|
2680
|
+
now: () => number;
|
|
2681
|
+
/** Set frame rate */
|
|
2682
|
+
setFrameRate: (fps: number) => void;
|
|
2683
|
+
}
|
|
2684
|
+
/**
|
|
2685
|
+
* Interval handle
|
|
2686
|
+
* @interface IntervalHandle
|
|
2687
|
+
*/
|
|
2688
|
+
export interface IntervalHandle {
|
|
2689
|
+
/** Interval ID */
|
|
2690
|
+
id: number;
|
|
2691
|
+
/** Clear interval */
|
|
2692
|
+
clear: () => void;
|
|
2693
|
+
/** Check if active */
|
|
2694
|
+
isActive: () => boolean;
|
|
2695
|
+
}
|
|
2696
|
+
/**
|
|
2697
|
+
* Schedule handle
|
|
2698
|
+
* @interface ScheduleHandle
|
|
2699
|
+
*/
|
|
2700
|
+
export interface ScheduleHandle {
|
|
2701
|
+
/** Timeout ID */
|
|
2702
|
+
id: number;
|
|
2703
|
+
/** Cancel schedule */
|
|
2704
|
+
cancel: () => void;
|
|
2705
|
+
/** Check if pending */
|
|
2706
|
+
isPending: () => boolean;
|
|
2707
|
+
}
|
|
2708
|
+
/**
|
|
2709
|
+
* Timer interface
|
|
2710
|
+
* @interface Timer
|
|
2711
|
+
*/
|
|
2712
|
+
export interface Timer {
|
|
2713
|
+
/** Start time */
|
|
2714
|
+
startTime: number;
|
|
2715
|
+
/** End time */
|
|
2716
|
+
endTime?: number;
|
|
2717
|
+
/** Elapsed time */
|
|
2718
|
+
elapsed: number;
|
|
2719
|
+
/** Timer label */
|
|
2720
|
+
label?: string;
|
|
2721
|
+
}
|
|
2722
|
+
/**
|
|
2723
|
+
* Countdown timer
|
|
2724
|
+
* @interface Countdown
|
|
2725
|
+
*/
|
|
2726
|
+
export interface Countdown {
|
|
2727
|
+
/** Remaining time */
|
|
2728
|
+
remaining: number;
|
|
2729
|
+
/** Total duration */
|
|
2730
|
+
duration: number;
|
|
2731
|
+
/** Is running */
|
|
2732
|
+
isRunning: boolean;
|
|
2733
|
+
/** Is complete */
|
|
2734
|
+
isComplete: boolean;
|
|
2735
|
+
/** Completion callback */
|
|
2736
|
+
onComplete?: () => void;
|
|
2737
|
+
}
|
|
2738
|
+
/**
|
|
2739
|
+
* History entry
|
|
2740
|
+
* @interface HistoryEntry
|
|
2741
|
+
*/
|
|
2742
|
+
export interface HistoryEntry {
|
|
2743
|
+
/** Entry URL */
|
|
2744
|
+
url: string;
|
|
2745
|
+
/** Entry state */
|
|
2746
|
+
state?: unknown;
|
|
2747
|
+
/** Entry title */
|
|
2748
|
+
title?: string;
|
|
2749
|
+
/** Entry timestamp */
|
|
2750
|
+
timestamp: number;
|
|
2751
|
+
}
|
|
2752
|
+
/**
|
|
2753
|
+
* Mock history object
|
|
2754
|
+
* @interface MockHistory
|
|
2755
|
+
*/
|
|
2756
|
+
export interface MockHistory {
|
|
2757
|
+
/** History entries */
|
|
2758
|
+
entries: HistoryEntry[];
|
|
2759
|
+
/** Current index */
|
|
2760
|
+
index: number;
|
|
2761
|
+
/** Push entry */
|
|
2762
|
+
push: (url: string, state?: unknown) => void;
|
|
2763
|
+
/** Replace entry */
|
|
2764
|
+
replace: (url: string, state?: unknown) => void;
|
|
2765
|
+
/** Go back */
|
|
2766
|
+
back: () => void;
|
|
2767
|
+
/** Go forward */
|
|
2768
|
+
forward: () => void;
|
|
2769
|
+
/** Go to index */
|
|
2770
|
+
go: (delta: number) => void;
|
|
2771
|
+
}
|
|
2772
|
+
/**
|
|
2773
|
+
* Mock location object
|
|
2774
|
+
* @interface MockLocation
|
|
2775
|
+
*/
|
|
2776
|
+
export interface MockLocation {
|
|
2777
|
+
/** Current pathname */
|
|
2778
|
+
pathname: string;
|
|
2779
|
+
/** Current search */
|
|
2780
|
+
search: string;
|
|
2781
|
+
/** Current hash */
|
|
2782
|
+
hash: string;
|
|
2783
|
+
/** Current state */
|
|
2784
|
+
state?: unknown;
|
|
2785
|
+
/** Location key */
|
|
2786
|
+
key: string;
|
|
2787
|
+
}
|
|
2788
|
+
/**
|
|
2789
|
+
* Route expectation
|
|
2790
|
+
* @interface RouteExpectation
|
|
2791
|
+
*/
|
|
2792
|
+
export interface RouteExpectation {
|
|
2793
|
+
/** Expected path */
|
|
2794
|
+
path: string;
|
|
2795
|
+
/** Expected params */
|
|
2796
|
+
params?: Record<string, string>;
|
|
2797
|
+
/** Expected query */
|
|
2798
|
+
query?: Record<string, string>;
|
|
2799
|
+
/** Should match exactly */
|
|
2800
|
+
exact?: boolean;
|
|
2801
|
+
}
|
|
2802
|
+
/**
|
|
2803
|
+
* Route guard configuration
|
|
2804
|
+
* @interface RouteGuard
|
|
2805
|
+
*/
|
|
2806
|
+
export interface RouteGuard {
|
|
2807
|
+
/** Guard name */
|
|
2808
|
+
name: string;
|
|
2809
|
+
/** Guard function */
|
|
2810
|
+
guard: (route: string) => boolean | Promise<boolean>;
|
|
2811
|
+
/** Redirect path */
|
|
2812
|
+
redirectTo?: string;
|
|
2813
|
+
/** Guard priority */
|
|
2814
|
+
priority?: number;
|
|
2815
|
+
}
|
|
2816
|
+
/**
|
|
2817
|
+
* Guard scenario for testing
|
|
2818
|
+
* @interface GuardScenario
|
|
2819
|
+
*/
|
|
2820
|
+
export interface GuardScenario {
|
|
2821
|
+
/** Scenario name */
|
|
2822
|
+
name: string;
|
|
2823
|
+
/** Route to test */
|
|
2824
|
+
route: string;
|
|
2825
|
+
/** Expected guard result */
|
|
2826
|
+
expectedResult: boolean;
|
|
2827
|
+
/** Expected redirect */
|
|
2828
|
+
expectedRedirect?: string;
|
|
2829
|
+
}
|
|
2830
|
+
/**
|
|
2831
|
+
* Navigation options
|
|
2832
|
+
* @interface NavOptions
|
|
2833
|
+
*/
|
|
2834
|
+
export interface NavOptions {
|
|
2835
|
+
/** Replace current entry */
|
|
2836
|
+
replace?: boolean;
|
|
2837
|
+
/** Navigation state */
|
|
2838
|
+
state?: unknown;
|
|
2839
|
+
/** Prevent default */
|
|
2840
|
+
preventDefault?: boolean;
|
|
2841
|
+
}
|
|
2842
|
+
/**
|
|
2843
|
+
* Next.js testing options
|
|
2844
|
+
* @interface NextOptions
|
|
2845
|
+
*/
|
|
2846
|
+
export interface NextOptions {
|
|
2847
|
+
/** Router configuration */
|
|
2848
|
+
router?: Partial<unknown>;
|
|
2849
|
+
/** Current pathname */
|
|
2850
|
+
pathname?: string;
|
|
2851
|
+
/** Search parameters */
|
|
2852
|
+
searchParams?: Record<string, string>;
|
|
2853
|
+
/** Request cookies */
|
|
2854
|
+
cookies?: Record<string, string>;
|
|
2855
|
+
}
|
|
2856
|
+
/**
|
|
2857
|
+
* Next.js test context
|
|
2858
|
+
* @interface NextTestContext
|
|
2859
|
+
*/
|
|
2860
|
+
export interface NextTestContext {
|
|
2861
|
+
/** Mock router instance */
|
|
2862
|
+
router: unknown;
|
|
2863
|
+
/** Navigation mock */
|
|
2864
|
+
navigation: unknown;
|
|
2865
|
+
/** Request mock */
|
|
2866
|
+
req: unknown;
|
|
2867
|
+
/** Response mock */
|
|
2868
|
+
res: unknown;
|
|
2869
|
+
/** Reset function */
|
|
2870
|
+
reset: () => void;
|
|
2871
|
+
}
|
|
2872
|
+
/**
|
|
2873
|
+
* Server-side props context for testing
|
|
2874
|
+
* @interface SSPContext
|
|
2875
|
+
*/
|
|
2876
|
+
export interface SSPContext {
|
|
2877
|
+
/** Test scenario name */
|
|
2878
|
+
scenario?: string;
|
|
2879
|
+
/** Expected props */
|
|
2880
|
+
expectedProps?: Record<string, unknown>;
|
|
2881
|
+
/** Expected redirect */
|
|
2882
|
+
expectedRedirect?: {
|
|
2883
|
+
destination: string;
|
|
2884
|
+
permanent?: boolean;
|
|
2885
|
+
};
|
|
2886
|
+
/** Expect not found */
|
|
2887
|
+
expectNotFound?: boolean;
|
|
2888
|
+
/** Request parameters */
|
|
2889
|
+
params?: Record<string, string>;
|
|
2890
|
+
/** Query parameters */
|
|
2891
|
+
query?: Record<string, string>;
|
|
2892
|
+
/** Request headers */
|
|
2893
|
+
headers?: Record<string, string>;
|
|
2894
|
+
}
|
|
2895
|
+
/**
|
|
2896
|
+
* Static props context for testing
|
|
2897
|
+
* @interface SPContext
|
|
2898
|
+
*/
|
|
2899
|
+
export interface SPContext {
|
|
2900
|
+
/** Test scenario name */
|
|
2901
|
+
scenario?: string;
|
|
2902
|
+
/** Expected props */
|
|
2903
|
+
expectedProps?: Record<string, unknown>;
|
|
2904
|
+
/** Expected revalidation time */
|
|
2905
|
+
expectedRevalidate?: number;
|
|
2906
|
+
/** Expected redirect */
|
|
2907
|
+
expectedRedirect?: {
|
|
2908
|
+
destination: string;
|
|
2909
|
+
permanent?: boolean;
|
|
2910
|
+
};
|
|
2911
|
+
/** Expect not found */
|
|
2912
|
+
expectNotFound?: boolean;
|
|
2913
|
+
/** Route parameters */
|
|
2914
|
+
params?: Record<string, string>;
|
|
2915
|
+
}
|
|
2916
|
+
/**
|
|
2917
|
+
* API request test configuration
|
|
2918
|
+
* @interface APIRequest
|
|
2919
|
+
*/
|
|
2920
|
+
export interface APIRequest {
|
|
2921
|
+
/** Test scenario name */
|
|
2922
|
+
scenario?: string;
|
|
2923
|
+
/** HTTP method */
|
|
2924
|
+
method?: string;
|
|
2925
|
+
/** Request headers */
|
|
2926
|
+
headers?: Record<string, string>;
|
|
2927
|
+
/** Request body */
|
|
2928
|
+
body?: unknown;
|
|
2929
|
+
/** Query parameters */
|
|
2930
|
+
query?: Record<string, string>;
|
|
2931
|
+
/** Request cookies */
|
|
2932
|
+
cookies?: Record<string, string>;
|
|
2933
|
+
/** Expected status code */
|
|
2934
|
+
expectedStatus?: number;
|
|
2935
|
+
/** Expected response body */
|
|
2936
|
+
expectedBody?: unknown;
|
|
2937
|
+
/** Expected response headers */
|
|
2938
|
+
expectedHeaders?: Record<string, string>;
|
|
2939
|
+
}
|
|
2940
|
+
/**
|
|
2941
|
+
* Lifecycle testing scenario
|
|
2942
|
+
* @interface LifecycleScenario
|
|
2943
|
+
*/
|
|
2944
|
+
export interface LifecycleScenario {
|
|
2945
|
+
/** Scenario name */
|
|
2946
|
+
name: string;
|
|
2947
|
+
/** Action to perform */
|
|
2948
|
+
action: () => void | Promise<void>;
|
|
2949
|
+
/** Expected state after action */
|
|
2950
|
+
expectedState?: Record<string, unknown>;
|
|
2951
|
+
/** Expected events */
|
|
2952
|
+
expectedEvents?: string[];
|
|
2953
|
+
}
|
|
2954
|
+
/**
|
|
2955
|
+
* Lifecycle event tracker
|
|
2956
|
+
* @interface LifecycleTracker
|
|
2957
|
+
*/
|
|
2958
|
+
export interface LifecycleTracker {
|
|
2959
|
+
/** Recorded events */
|
|
2960
|
+
events: Array<{
|
|
2961
|
+
type: string;
|
|
2962
|
+
timestamp: number;
|
|
2963
|
+
data?: unknown;
|
|
2964
|
+
}>;
|
|
2965
|
+
/** Clear all events */
|
|
2966
|
+
clear: () => void;
|
|
2967
|
+
/** Get all events */
|
|
2968
|
+
getEvents: () => Array<{
|
|
2969
|
+
type: string;
|
|
2970
|
+
timestamp: number;
|
|
2971
|
+
data?: unknown;
|
|
2972
|
+
}>;
|
|
2973
|
+
/** Get events by type */
|
|
2974
|
+
getEventsByType: (type: string) => Array<{
|
|
2975
|
+
type: string;
|
|
2976
|
+
timestamp: number;
|
|
2977
|
+
data?: unknown;
|
|
2978
|
+
}>;
|
|
2979
|
+
}
|
|
2980
|
+
/**
|
|
2981
|
+
* Lifecycle event
|
|
2982
|
+
* @interface LifecycleEvent
|
|
2983
|
+
*/
|
|
2984
|
+
export interface LifecycleEvent {
|
|
2985
|
+
/** Event type */
|
|
2986
|
+
type: string;
|
|
2987
|
+
/** Event data */
|
|
2988
|
+
data?: unknown;
|
|
2989
|
+
}
|
|
2990
|
+
/**
|
|
2991
|
+
* Cleanup operation result
|
|
2992
|
+
* @interface CleanupResult
|
|
2993
|
+
*/
|
|
2994
|
+
export interface CleanupResult {
|
|
2995
|
+
/** Whether cleanup was successful */
|
|
2996
|
+
cleanedUp: boolean;
|
|
2997
|
+
/** Cleaned up resources */
|
|
2998
|
+
resources: string[];
|
|
2999
|
+
/** Cleanup errors */
|
|
3000
|
+
errors: Error[];
|
|
3001
|
+
}
|
|
3002
|
+
/**
|
|
3003
|
+
* Lifecycle performance metrics
|
|
3004
|
+
* @interface LifecycleMetrics
|
|
3005
|
+
*/
|
|
3006
|
+
export interface LifecycleMetrics {
|
|
3007
|
+
/** Mount time */
|
|
3008
|
+
mountTime: number;
|
|
3009
|
+
/** Update time */
|
|
3010
|
+
updateTime: number;
|
|
3011
|
+
/** Unmount time */
|
|
3012
|
+
unmountTime: number;
|
|
3013
|
+
}
|
|
3014
|
+
/**
|
|
3015
|
+
* File snapshot for testing
|
|
3016
|
+
* @interface FileSnapshot
|
|
3017
|
+
*/
|
|
3018
|
+
export interface FileSnapshot {
|
|
3019
|
+
/** File path */
|
|
3020
|
+
path: string;
|
|
3021
|
+
/** File size */
|
|
3022
|
+
size: number;
|
|
3023
|
+
/** Modification time */
|
|
3024
|
+
mtime: Date;
|
|
3025
|
+
/** File content */
|
|
3026
|
+
content: string;
|
|
3027
|
+
/** Content hash */
|
|
3028
|
+
hash: string;
|
|
3029
|
+
}
|
|
3030
|
+
/**
|
|
3031
|
+
* Environment configuration
|
|
3032
|
+
* @interface EnvConfig
|
|
3033
|
+
*/
|
|
3034
|
+
export interface EnvConfig {
|
|
3035
|
+
/** Base directory */
|
|
3036
|
+
baseDir?: string;
|
|
3037
|
+
/** Environment file path */
|
|
3038
|
+
envFile?: string;
|
|
3039
|
+
/** Override existing values */
|
|
3040
|
+
override?: boolean;
|
|
3041
|
+
/** Default values */
|
|
3042
|
+
defaults?: Record<string, string>;
|
|
3043
|
+
}
|
|
3044
|
+
/**
|
|
3045
|
+
* Test environment interface
|
|
3046
|
+
* @interface TestEnvironment
|
|
3047
|
+
*/
|
|
3048
|
+
export interface TestEnvironment {
|
|
3049
|
+
/** Get environment variable */
|
|
3050
|
+
get: (key: string) => string | undefined;
|
|
3051
|
+
/** Set environment variable */
|
|
3052
|
+
set: (key: string, value: string) => void;
|
|
3053
|
+
/** Reset environment */
|
|
3054
|
+
reset: () => void;
|
|
3055
|
+
/** Load environment configuration */
|
|
3056
|
+
load: (config: EnvConfig) => void;
|
|
3057
|
+
}
|
|
3058
|
+
/**
|
|
3059
|
+
* Environment mock interface
|
|
3060
|
+
* @interface EnvMock
|
|
3061
|
+
*/
|
|
3062
|
+
export interface EnvMock {
|
|
3063
|
+
/** Restore original environment */
|
|
3064
|
+
restore: () => void;
|
|
3065
|
+
/** Update environment variables */
|
|
3066
|
+
update: (vars: Record<string, string>) => void;
|
|
3067
|
+
/** Clear environment variables */
|
|
3068
|
+
clear: () => void;
|
|
3069
|
+
}
|
|
3070
|
+
/**
|
|
3071
|
+
* Environment snapshot
|
|
3072
|
+
* @interface EnvSnapshot
|
|
3073
|
+
*/
|
|
3074
|
+
export interface EnvSnapshot {
|
|
3075
|
+
/** Environment variables */
|
|
3076
|
+
variables: Record<string, string | undefined>;
|
|
3077
|
+
/** Snapshot timestamp */
|
|
3078
|
+
timestamp: number;
|
|
3079
|
+
}
|
|
3080
|
+
/**
|
|
3081
|
+
* System signal type
|
|
3082
|
+
* @type Signal
|
|
3083
|
+
*/
|
|
3084
|
+
export type Signal = 'SIGTERM' | 'SIGINT' | 'SIGHUP' | 'SIGUSR1' | 'SIGUSR2';
|
|
3085
|
+
/**
|
|
3086
|
+
* Signal handler function
|
|
3087
|
+
* @type SignalHandler
|
|
3088
|
+
*/
|
|
3089
|
+
export type SignalHandler = (signal: Signal) => void | Promise<void>;
|
|
3090
|
+
/**
|
|
3091
|
+
* Component type for lifecycle testing
|
|
3092
|
+
* @type ComponentType
|
|
3093
|
+
* @typeParam P - Props type
|
|
3094
|
+
*/
|
|
3095
|
+
export type ComponentType<P = Record<string, unknown>> = new (props: P) => React.Component<P>;
|
|
3096
|
+
/**
|
|
3097
|
+
* Next.js Get Server-Side Props function
|
|
3098
|
+
* @type GSSP
|
|
3099
|
+
* @typeParam T - Props type
|
|
3100
|
+
*/
|
|
3101
|
+
export type GSSP<T = unknown> = (context: T) => Promise<T>;
|
|
3102
|
+
/**
|
|
3103
|
+
* Next.js Get Static Props function
|
|
3104
|
+
* @type GSP
|
|
3105
|
+
* @typeParam T - Props type
|
|
3106
|
+
*/
|
|
3107
|
+
export type GSP<T = unknown> = (context: T) => Promise<T>;
|
|
3108
|
+
/**
|
|
3109
|
+
* Next.js API handler function
|
|
3110
|
+
* @type APIHandler
|
|
3111
|
+
*/
|
|
3112
|
+
export type APIHandler = (req: unknown, res: unknown) => Promise<void> | void;
|
|
3113
|
+
/**
|
|
3114
|
+
* Touch gesture type
|
|
3115
|
+
* @type TouchGesture
|
|
3116
|
+
*/
|
|
3117
|
+
export type TouchGesture = 'tap' | 'swipe' | 'pinch' | 'rotate' | 'longPress';
|
|
3118
|
+
/**
|
|
3119
|
+
* File watch callback function
|
|
3120
|
+
* @type WatchCallback
|
|
3121
|
+
*/
|
|
3122
|
+
export type WatchCallback = (event: string, filename: string | null) => void;
|
|
3123
|
+
/**
|
|
3124
|
+
* Pipeline result interface
|
|
3125
|
+
* @interface PipelineResult
|
|
3126
|
+
*/
|
|
3127
|
+
export interface PipelineResult {
|
|
3128
|
+
/** Output buffer */
|
|
3129
|
+
output: globalThis.Buffer;
|
|
3130
|
+
/** Errors array */
|
|
3131
|
+
errors: Error[];
|
|
3132
|
+
/** Duration in milliseconds */
|
|
3133
|
+
duration: number;
|
|
3134
|
+
}
|
|
3135
|
+
/**
|
|
3136
|
+
* Module mocks interface
|
|
3137
|
+
* @interface ModuleMocks
|
|
3138
|
+
*/
|
|
3139
|
+
export interface ModuleMocks {
|
|
3140
|
+
/** Restore function */
|
|
3141
|
+
restore: () => void;
|
|
3142
|
+
/** Get call count for module */
|
|
3143
|
+
getCallCount: (moduleName: string) => number;
|
|
3144
|
+
/** Get last call for module */
|
|
3145
|
+
getLastCall: (moduleName: string) => unknown[];
|
|
3146
|
+
}
|
|
3147
|
+
/**
|
|
3148
|
+
* Async hook interface
|
|
3149
|
+
* @interface AsyncHook
|
|
3150
|
+
*/
|
|
3151
|
+
export interface AsyncHook {
|
|
3152
|
+
/** Init callback */
|
|
3153
|
+
init?: (asyncId: number, type: string, triggerAsyncId: number) => void;
|
|
3154
|
+
/** Before callback */
|
|
3155
|
+
before?: (asyncId: number) => void;
|
|
3156
|
+
/** After callback */
|
|
3157
|
+
after?: (asyncId: number) => void;
|
|
3158
|
+
/** Destroy callback */
|
|
3159
|
+
destroy?: (asyncId: number) => void;
|
|
1970
3160
|
}
|