@plyaz/types 1.7.4 → 1.7.6
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/common/types.d.ts +6 -6
- package/dist/features/cache/types.d.ts +3 -4
- package/dist/features/feature-flag/types.d.ts +11 -11
- package/dist/testing/common/assertions/types.d.ts +7 -7
- package/dist/testing/common/factories/types.d.ts +5 -5
- package/dist/testing/common/mocks/types.d.ts +3 -3
- package/dist/testing/common/utils/types.d.ts +25 -25
- package/dist/testing/common/wrappers/types.d.ts +3 -4
- package/dist/testing/features/feature-flags/types.d.ts +3 -3
- package/package.json +1 -1
package/dist/common/types.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* // getUser("abc") // ❌ Type error
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
|
-
import type { Arrayable, SetOptional, Tagged
|
|
15
|
+
import type { Arrayable, SetOptional, Tagged } from 'type-fest';
|
|
16
16
|
export type Brand<T, B extends PropertyKey> = Tagged<T, B>;
|
|
17
17
|
/**
|
|
18
18
|
* Branded `string` type representing a unique identifier.
|
|
@@ -239,7 +239,7 @@ export interface Describable extends Named {
|
|
|
239
239
|
* Base interface for entities with metadata.
|
|
240
240
|
* Provides metadata field for extensibility.
|
|
241
241
|
*
|
|
242
|
-
* @typeParam T - Type of the metadata object, defaults to
|
|
242
|
+
* @typeParam T - Type of the metadata object, defaults to Record<string, unknown>
|
|
243
243
|
*
|
|
244
244
|
* @example
|
|
245
245
|
* ```typescript
|
|
@@ -253,7 +253,7 @@ export interface Describable extends Named {
|
|
|
253
253
|
* }
|
|
254
254
|
* ```
|
|
255
255
|
*/
|
|
256
|
-
export interface WithMetadata<T =
|
|
256
|
+
export interface WithMetadata<T = Record<string, unknown>> {
|
|
257
257
|
/** Metadata for additional information */
|
|
258
258
|
metadata: T;
|
|
259
259
|
}
|
|
@@ -594,7 +594,7 @@ export interface WithEnvironment {
|
|
|
594
594
|
*/
|
|
595
595
|
export interface WithPlatform {
|
|
596
596
|
/** Platform(s) this entity supports */
|
|
597
|
-
platform: 'web' | '
|
|
597
|
+
platform: 'web' | 'mobile' | 'desktop' | 'ios' | 'android';
|
|
598
598
|
}
|
|
599
599
|
/**
|
|
600
600
|
* Base interface for entities with API key.
|
|
@@ -1044,7 +1044,7 @@ export interface WithLabels {
|
|
|
1044
1044
|
*/
|
|
1045
1045
|
export interface WithAnnotations {
|
|
1046
1046
|
/** Additional annotations */
|
|
1047
|
-
annotations:
|
|
1047
|
+
annotations: Record<string, unknown>;
|
|
1048
1048
|
}
|
|
1049
1049
|
/**
|
|
1050
1050
|
* Base interface for entities with email.
|
|
@@ -1480,7 +1480,7 @@ export interface WithErrorCode {
|
|
|
1480
1480
|
* }
|
|
1481
1481
|
* ```
|
|
1482
1482
|
*/
|
|
1483
|
-
export interface WithErrorDetailed<T =
|
|
1483
|
+
export interface WithErrorDetailed<T = Record<string, unknown>> extends WithTimestamp, SetOptional<WithPath, 'path'>, WithMessage, WithStatusCode {
|
|
1484
1484
|
/** Error type/name */
|
|
1485
1485
|
error: string;
|
|
1486
1486
|
/** Additional error details */
|
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
/**
|
|
11
11
|
* Cache entry structure that wraps cached data with metadata.
|
|
12
12
|
*/
|
|
13
|
-
import type { UnknownRecord } from 'type-fest';
|
|
14
13
|
import type { Configurable, WithExpiration, WithMetadata, Enabled, WithUrl, Timestamped } from '../../common/types';
|
|
15
|
-
export interface CacheEntry<T = unknown> extends Partial<WithMetadata<
|
|
14
|
+
export interface CacheEntry<T = unknown> extends Partial<WithMetadata<Record<string, unknown>>>, WithExpiration<number>, Pick<Timestamped<number, number>, 'createdAt'> {
|
|
16
15
|
/** The cached data */
|
|
17
16
|
data: T;
|
|
18
17
|
}
|
|
@@ -94,9 +93,9 @@ export interface CacheStrategy {
|
|
|
94
93
|
* Retrieves a cache entry.
|
|
95
94
|
*
|
|
96
95
|
* @param key - Cache key
|
|
97
|
-
* @returns Promise that resolves to cache entry or null
|
|
96
|
+
* @returns Promise that resolves to cache entry or null if not found
|
|
98
97
|
*/
|
|
99
|
-
get<T>(key: string): Promise<CacheEntry<T> | null
|
|
98
|
+
get<T>(key: string): Promise<CacheEntry<T> | null>;
|
|
100
99
|
/**
|
|
101
100
|
* Removes a cache entry.
|
|
102
101
|
*
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
* @fileoverview Feature flags domain type definitions
|
|
7
7
|
* @version 1.0.0
|
|
8
8
|
*/
|
|
9
|
-
import type {
|
|
9
|
+
import type { UnknownArray, Arrayable, SetOptional } from 'type-fest';
|
|
10
10
|
import type * as React from 'react';
|
|
11
11
|
import type { Describable, Timestamped, WithMetadata, Loadable, Authored, WithTags, WithEnvironment, Identifiable, Named, WithLogging, WithApiKey, Initializable, Refreshable, WithOperation, Enabled, WithError, KeyValuePair, WithUserId, WithCountry, Versioned, WithPlatform, WithPriority, ValidationResult } from '../../common/types';
|
|
12
12
|
/**
|
|
13
13
|
* Possible values that a feature flag can hold.
|
|
14
14
|
* Supports primitive types and JSON objects for complex configurations.
|
|
15
15
|
*/
|
|
16
|
-
export type FeatureFlagValue = boolean | string | number |
|
|
16
|
+
export type FeatureFlagValue = boolean | string | number | Record<string, unknown>;
|
|
17
17
|
/**
|
|
18
18
|
* Core feature flag definition interface.
|
|
19
19
|
* Represents a complete feature flag with all its metadata and configuration.
|
|
@@ -57,7 +57,7 @@ export interface FeatureFlagContext extends SetOptional<WithUserId, 'userId'>, S
|
|
|
57
57
|
/** User's role or permission level */
|
|
58
58
|
userRole?: string;
|
|
59
59
|
/** Custom context data for advanced targeting */
|
|
60
|
-
custom?:
|
|
60
|
+
custom?: Record<string, unknown>;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Result of a feature flag evaluation.
|
|
@@ -96,13 +96,13 @@ export interface FeatureFlagConfig<FeatureFlagKey extends string> extends SetOpt
|
|
|
96
96
|
databaseConfig?: {
|
|
97
97
|
connectionString: string;
|
|
98
98
|
tableName: string;
|
|
99
|
-
options?:
|
|
99
|
+
options?: Record<string, unknown>;
|
|
100
100
|
};
|
|
101
101
|
/** Redis configuration (required if provider is 'redis') */
|
|
102
102
|
redisConfig?: {
|
|
103
103
|
url: string;
|
|
104
104
|
keyPrefix: string;
|
|
105
|
-
options?:
|
|
105
|
+
options?: Record<string, unknown>;
|
|
106
106
|
};
|
|
107
107
|
/** File configuration (required if provider is 'file') */
|
|
108
108
|
fileConfig?: {
|
|
@@ -316,7 +316,7 @@ export interface FlagUpdateTestInput<FeatureFlagKey extends string> {
|
|
|
316
316
|
/** Key of the flag to update */
|
|
317
317
|
flagKey: FeatureFlagKey;
|
|
318
318
|
/** Update data object */
|
|
319
|
-
updateData:
|
|
319
|
+
updateData: Record<string, unknown>;
|
|
320
320
|
}
|
|
321
321
|
/**
|
|
322
322
|
* Input for override test cases
|
|
@@ -386,8 +386,8 @@ export interface TimestampTestInput extends WithOperation<'create' | 'update'> {
|
|
|
386
386
|
expectedTimestampBehavior: string;
|
|
387
387
|
}
|
|
388
388
|
export interface ModuleConfigurationTestInput {
|
|
389
|
-
config:
|
|
390
|
-
expectedConfig:
|
|
389
|
+
config: Record<string, unknown>;
|
|
390
|
+
expectedConfig: Record<string, unknown>;
|
|
391
391
|
}
|
|
392
392
|
/**
|
|
393
393
|
* Input for provider type test cases.
|
|
@@ -498,7 +498,7 @@ export interface RuleEvaluationTestInput<FeatureFlagKey extends string> {
|
|
|
498
498
|
/** Array of rules with conditions and values */
|
|
499
499
|
rules: Array<{
|
|
500
500
|
/** Conditions that must be met */
|
|
501
|
-
conditions:
|
|
501
|
+
conditions: Record<string, unknown>;
|
|
502
502
|
/** Value to return if conditions match */
|
|
503
503
|
value: FeatureFlagValue;
|
|
504
504
|
}>;
|
|
@@ -574,7 +574,7 @@ export interface ValidationTestInput extends Pick<ValidationResult, 'isValid'> {
|
|
|
574
574
|
*/
|
|
575
575
|
export interface DynamicModuleTestInput {
|
|
576
576
|
/** Module configuration object */
|
|
577
|
-
config:
|
|
577
|
+
config: Record<string, unknown>;
|
|
578
578
|
/** Expected providers to be registered */
|
|
579
579
|
expectedProviders?: string[];
|
|
580
580
|
/** Expected modules to be imported */
|
|
@@ -603,7 +603,7 @@ export interface AsyncModuleConfigTestInput {
|
|
|
603
603
|
/** Services to inject into factory */
|
|
604
604
|
inject?: string[];
|
|
605
605
|
/** Factory function for configuration */
|
|
606
|
-
useFactory?: (...args: unknown[]) =>
|
|
606
|
+
useFactory?: (...args: unknown[]) => Record<string, unknown>;
|
|
607
607
|
/** Expected modules in result */
|
|
608
608
|
expectedImports?: string[];
|
|
609
609
|
/** Expected providers in result */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Type definitions for assertion utilities.
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { UnknownArray, SetOptional } from 'type-fest';
|
|
7
7
|
import type { WithStatusCode, WithMessage, WithTimestamp, WithCorrelationId, WithMetadata, Named, WithRequestId, WithStatus } from '../../../common/types';
|
|
8
8
|
/**
|
|
9
9
|
* Pattern for matching HTTP errors with status code and message.
|
|
@@ -65,7 +65,7 @@ export interface ErrorTimelineEntry extends WithTimestamp<number> {
|
|
|
65
65
|
/** The error that occurred */
|
|
66
66
|
error: Error;
|
|
67
67
|
/** Additional context data at the time of error */
|
|
68
|
-
context?:
|
|
68
|
+
context?: Record<string, unknown>;
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* Expected error pattern for validation.
|
|
@@ -139,7 +139,7 @@ export interface ErrorRecoveryResult {
|
|
|
139
139
|
* Entry for correlating errors with additional context.
|
|
140
140
|
* Used in error tracking and debugging systems.
|
|
141
141
|
*/
|
|
142
|
-
export interface ErrorCorrelationEntry extends Partial<WithMetadata<
|
|
142
|
+
export interface ErrorCorrelationEntry extends Partial<WithMetadata<Record<string, unknown>>> {
|
|
143
143
|
/** The original error that triggered recovery */
|
|
144
144
|
error: Error;
|
|
145
145
|
}
|
|
@@ -217,7 +217,7 @@ export interface ErrorCircuitBreaker<T> {
|
|
|
217
217
|
*/
|
|
218
218
|
export interface ErrorCorrelator {
|
|
219
219
|
/** Create correlation ID for an error */
|
|
220
|
-
correlate: (error: Error, metadata?:
|
|
220
|
+
correlate: (error: Error, metadata?: Record<string, unknown>) => string;
|
|
221
221
|
/** Get all errors with same correlation ID */
|
|
222
222
|
getRelated: (correlationId: string) => Array<ErrorCorrelationEntry>;
|
|
223
223
|
/** Get chain of errors leading to this one */
|
|
@@ -229,7 +229,7 @@ export interface ErrorCorrelator {
|
|
|
229
229
|
*/
|
|
230
230
|
export interface ErrorMetrics {
|
|
231
231
|
/** Record an error occurrence */
|
|
232
|
-
record: (error: Error, context?:
|
|
232
|
+
record: (error: Error, context?: Record<string, unknown>) => void;
|
|
233
233
|
/** Get aggregated error metrics */
|
|
234
234
|
getMetrics: () => {
|
|
235
235
|
/** Total error count */
|
|
@@ -289,7 +289,7 @@ export interface ValidationMessage {
|
|
|
289
289
|
* Expected HTTP exception pattern for testing.
|
|
290
290
|
* Used to assert specific HTTP error responses.
|
|
291
291
|
*/
|
|
292
|
-
export interface ExpectedHttpException extends Partial<WithStatusCode>, WithStatus {
|
|
292
|
+
export interface ExpectedHttpException extends Partial<WithStatusCode>, WithStatus<number> {
|
|
293
293
|
/** Expected error message or pattern */
|
|
294
294
|
message?: string | RegExp;
|
|
295
295
|
/** Expected response body */
|
|
@@ -319,7 +319,7 @@ export interface ErrorPropagationInjection {
|
|
|
319
319
|
* Context data for enriching errors with additional information.
|
|
320
320
|
* Helps with debugging and error tracking.
|
|
321
321
|
*/
|
|
322
|
-
export interface ErrorEnrichmentContext extends Partial<WithTimestamp<number>>, Partial<WithCorrelationId>, Partial<WithMetadata<
|
|
322
|
+
export interface ErrorEnrichmentContext extends Partial<WithTimestamp<number>>, Partial<WithCorrelationId>, Partial<WithMetadata<Record<string, unknown>>>, Partial<WithRequestId> {
|
|
323
323
|
/** Operation being performed when error occurred */
|
|
324
324
|
operation?: string;
|
|
325
325
|
/** User identifier associated with error */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Type definitions for factory utilities.
|
|
5
5
|
*/
|
|
6
|
-
import type { Promisable,
|
|
6
|
+
import type { Promisable, UnknownArray, SetOptional } from 'type-fest';
|
|
7
7
|
import type * as Vitest from 'vitest';
|
|
8
8
|
import type { Entity, Named, WithMetadata, Timestamped, SoftDeletable, Describable, Authored, WithTags, Versioned, WithSource, WithLabels, WithAnnotations, Tracked, WithDuration, WithExpiration, WithLastAccessed, NavigablePaginatedCollection, WithTimestamp, WithEmail, WithRoles, WithPermissions, WithUserId, WithLocale, WithTimezone, WithUserAgent, WithIpAddress, WithCountry, WithEnvironment, WithHttpStatus, WithRequestId, WithHeaders, WithErrorDetailed } from '../../../common/types';
|
|
9
9
|
/**
|
|
@@ -372,7 +372,7 @@ export interface UpdateResult {
|
|
|
372
372
|
/** Number of affected rows */
|
|
373
373
|
affected: number;
|
|
374
374
|
/** Raw database response */
|
|
375
|
-
raw:
|
|
375
|
+
raw: Record<string, unknown>;
|
|
376
376
|
/** Generated entity maps */
|
|
377
377
|
generatedMaps: UnknownArray;
|
|
378
378
|
}
|
|
@@ -393,7 +393,7 @@ export interface DeleteResult {
|
|
|
393
393
|
/** Number of affected rows */
|
|
394
394
|
affected: number;
|
|
395
395
|
/** Raw database response */
|
|
396
|
-
raw:
|
|
396
|
+
raw: Record<string, unknown>;
|
|
397
397
|
}
|
|
398
398
|
/**
|
|
399
399
|
* HTTP HEAD response interface
|
|
@@ -424,7 +424,7 @@ export type HeadResponse = WithHeaders;
|
|
|
424
424
|
*/
|
|
425
425
|
export interface DataResponse {
|
|
426
426
|
/** Response data */
|
|
427
|
-
data:
|
|
427
|
+
data: Record<string, unknown>;
|
|
428
428
|
}
|
|
429
429
|
/**
|
|
430
430
|
* Mock definition interface for configuring mock objects
|
|
@@ -623,7 +623,7 @@ export interface ScenarioResult<T> {
|
|
|
623
623
|
* };
|
|
624
624
|
* ```
|
|
625
625
|
*/
|
|
626
|
-
export interface TrackedCallRecord<TArgs extends unknown[], TReturn, TTimestamp = Date> extends Omit<Tracked<TReturn | undefined>, 'timestamp'>, WithDuration
|
|
626
|
+
export interface TrackedCallRecord<TArgs extends unknown[], TReturn, TTimestamp = Date> extends Omit<Tracked<TReturn | undefined>, 'timestamp'>, Partial<WithDuration>, WithTimestamp<TTimestamp> {
|
|
627
627
|
/** Function arguments */
|
|
628
628
|
args: TArgs;
|
|
629
629
|
}
|
|
@@ -42,7 +42,7 @@ import type * as Next from 'next';
|
|
|
42
42
|
import type * as NextRouter from 'next/router';
|
|
43
43
|
import type * as NextImage from 'next/image';
|
|
44
44
|
import type * as NextLink from 'next/link';
|
|
45
|
-
import type {
|
|
45
|
+
import type { UnknownArray, Arrayable } from 'type-fest';
|
|
46
46
|
import type { Named, WithStatusCode, WithStatusMessage, WithUrl, WithHttpMethod, WithHeaders, WithQueryParams, WithBody, WithCookies, WithParams, Resettable, WithStatus, Identifiable } from '../../../common/types';
|
|
47
47
|
/**
|
|
48
48
|
* Mock file system interface matching Node.js fs module
|
|
@@ -1854,7 +1854,7 @@ export interface MockSession extends Identifiable {
|
|
|
1854
1854
|
regenerate: Vitest.Mock;
|
|
1855
1855
|
touch: Vitest.Mock;
|
|
1856
1856
|
reload: Vitest.Mock;
|
|
1857
|
-
_data:
|
|
1857
|
+
_data: Record<string, unknown>;
|
|
1858
1858
|
_dirty: boolean;
|
|
1859
1859
|
_destroyed: boolean;
|
|
1860
1860
|
}
|
|
@@ -2127,7 +2127,7 @@ export interface MockWorkerThreads {
|
|
|
2127
2127
|
parentPort: unknown;
|
|
2128
2128
|
workerData: unknown;
|
|
2129
2129
|
threadId: number;
|
|
2130
|
-
resourceLimits:
|
|
2130
|
+
resourceLimits: Record<string, unknown>;
|
|
2131
2131
|
getEnvironmentData: Vitest.Mock<() => unknown>;
|
|
2132
2132
|
setEnvironmentData: Vitest.Mock<(key: string, value: unknown) => void>;
|
|
2133
2133
|
SHARE_ENV: symbol;
|
|
@@ -52,7 +52,7 @@ import type { Provider, Type } from '@nestjs/common';
|
|
|
52
52
|
import type { RenderOptions as RTLRenderOptions, RenderHookOptions as RTLRenderHookOptions } from '@testing-library/react';
|
|
53
53
|
import type { UserEvent as UserEventLib } from '@testing-library/user-event';
|
|
54
54
|
import type { MockEventEmitter, MockNextRouter, MockGetServerSidePropsContext, MockGetStaticPropsContext, MockNextApiResponse, MockNextApiRequest, TestScenario, CreateMockUseRouterReturn, CreateMockWebSocketReturn, CreateMockNextRequestFunction } from '..';
|
|
55
|
-
import type {
|
|
55
|
+
import type { UnknownArray, Promisable, Arrayable, SetOptional } from 'type-fest';
|
|
56
56
|
import type { KeyValueStore, Identifiable, WithUrl, WithHttpMethod, HttpMethod, WithHeaders, WithIpAddress, WithQueryParams, WithBody, Named, Clearable, Resettable, Describable, WithImpact, WithElement, WithDuration, IntervalControl, WithTimestamp, WithParams, WithTimeout, WithStatus, WithLocale, WithUserId, WithMessage } from '../../../common';
|
|
57
57
|
/**
|
|
58
58
|
* Subscription information for tracking subscriptions in tests
|
|
@@ -2015,7 +2015,7 @@ export interface LifecycleHook extends Named {
|
|
|
2015
2015
|
*/
|
|
2016
2016
|
export interface ComponentLifecycleTest extends Named {
|
|
2017
2017
|
Component: React.ComponentType<unknown>;
|
|
2018
|
-
props?:
|
|
2018
|
+
props?: Record<string, unknown>;
|
|
2019
2019
|
expectedHooks: LifecycleHook[];
|
|
2020
2020
|
interactions?: Array<{
|
|
2021
2021
|
action: () => Promisable<void>;
|
|
@@ -2134,7 +2134,7 @@ export interface ModuleLifecycleTest extends Named {
|
|
|
2134
2134
|
* ```
|
|
2135
2135
|
*/
|
|
2136
2136
|
export interface ApplicationLifecycleTest extends Named {
|
|
2137
|
-
app:
|
|
2137
|
+
app: Record<string, unknown>;
|
|
2138
2138
|
modules: unknown[];
|
|
2139
2139
|
expectedStartupSequence: string[];
|
|
2140
2140
|
expectedShutdownSequence: string[];
|
|
@@ -2305,9 +2305,9 @@ export interface EnvironmentTestCase extends Named {
|
|
|
2305
2305
|
* ```
|
|
2306
2306
|
*/
|
|
2307
2307
|
export interface ConfigTestScenario extends Named {
|
|
2308
|
-
config:
|
|
2308
|
+
config: Record<string, unknown>;
|
|
2309
2309
|
environment?: EnvironmentConfig;
|
|
2310
|
-
expectedValues:
|
|
2310
|
+
expectedValues: Record<string, unknown>;
|
|
2311
2311
|
shouldThrow?: boolean;
|
|
2312
2312
|
expectedError?: string | RegExp;
|
|
2313
2313
|
}
|
|
@@ -2980,7 +2980,7 @@ export interface NextJSTestSuite {
|
|
|
2980
2980
|
* };
|
|
2981
2981
|
* ```
|
|
2982
2982
|
*/
|
|
2983
|
-
export interface TestSuiteFactory<T extends
|
|
2983
|
+
export interface TestSuiteFactory<T extends Record<string, unknown>> {
|
|
2984
2984
|
runScenarios: (scenarios: TestScenario<T, unknown, unknown>[]) => void;
|
|
2985
2985
|
testMethod: (methodName: keyof T, testCases: Array<TestCaseWithSetup<T>>) => void;
|
|
2986
2986
|
testLifecycle: (lifecycleHooks: Array<LifecycleHookTestConfig<T>>) => void;
|
|
@@ -3135,7 +3135,7 @@ export interface MemoryLeakTestResult {
|
|
|
3135
3135
|
* ```
|
|
3136
3136
|
*/
|
|
3137
3137
|
export interface PropVariation extends Named {
|
|
3138
|
-
props:
|
|
3138
|
+
props: Record<string, unknown>;
|
|
3139
3139
|
expectation: () => void;
|
|
3140
3140
|
}
|
|
3141
3141
|
/**
|
|
@@ -3255,7 +3255,7 @@ export interface ErrorScenario<T> {
|
|
|
3255
3255
|
* ```
|
|
3256
3256
|
*/
|
|
3257
3257
|
export interface PropsTestScenario {
|
|
3258
|
-
props:
|
|
3258
|
+
props: Record<string, unknown>;
|
|
3259
3259
|
expectedContent?: string;
|
|
3260
3260
|
}
|
|
3261
3261
|
/**
|
|
@@ -3634,7 +3634,7 @@ export interface EnvironmentFeatureFlagScenario {
|
|
|
3634
3634
|
}
|
|
3635
3635
|
export interface DatabaseEnvironmentTest extends Named {
|
|
3636
3636
|
environment: EnvironmentConfig;
|
|
3637
|
-
expectedConfig:
|
|
3637
|
+
expectedConfig: Record<string, unknown>;
|
|
3638
3638
|
shouldConnect: boolean;
|
|
3639
3639
|
}
|
|
3640
3640
|
export interface LoggingEnvironmentTest extends Named {
|
|
@@ -3664,7 +3664,7 @@ export interface MockEnvironment extends Omit<KeyValueStore<string, string>, 'de
|
|
|
3664
3664
|
}
|
|
3665
3665
|
export interface EnvironmentTransformationTestCase {
|
|
3666
3666
|
input: EnvironmentConfig;
|
|
3667
|
-
expectedOutput:
|
|
3667
|
+
expectedOutput: Record<string, unknown>;
|
|
3668
3668
|
description: string;
|
|
3669
3669
|
}
|
|
3670
3670
|
export interface UserInteraction {
|
|
@@ -3692,9 +3692,9 @@ export interface MockNextNavigationOptions {
|
|
|
3692
3692
|
forward?: ReturnType<typeof Vitest.vi.fn>;
|
|
3693
3693
|
}
|
|
3694
3694
|
export interface SRTestOptions {
|
|
3695
|
-
initialProps:
|
|
3695
|
+
initialProps: Record<string, unknown>;
|
|
3696
3696
|
revalidate: number;
|
|
3697
|
-
newProps:
|
|
3697
|
+
newProps: Record<string, unknown>;
|
|
3698
3698
|
waitTime?: number;
|
|
3699
3699
|
}
|
|
3700
3700
|
export interface ApiRouteTestScenario extends Named {
|
|
@@ -3733,7 +3733,7 @@ export interface ApiRouteOptions extends Partial<WithUrl> {
|
|
|
3733
3733
|
cookies?: Record<string, string>;
|
|
3734
3734
|
}
|
|
3735
3735
|
export interface ServerComponentTestScenario extends Named {
|
|
3736
|
-
props:
|
|
3736
|
+
props: Record<string, unknown>;
|
|
3737
3737
|
searchParams?: Record<string, string>;
|
|
3738
3738
|
params?: Record<string, string>;
|
|
3739
3739
|
expectedContent?: string | RegExp;
|
|
@@ -3884,7 +3884,7 @@ export interface ComponentWithLoading {
|
|
|
3884
3884
|
* ```
|
|
3885
3885
|
*/
|
|
3886
3886
|
export interface ConditionalRenderingTest {
|
|
3887
|
-
props:
|
|
3887
|
+
props: Record<string, unknown>;
|
|
3888
3888
|
shouldRender: string[];
|
|
3889
3889
|
shouldNotRender: string[];
|
|
3890
3890
|
}
|
|
@@ -3905,7 +3905,7 @@ export interface ProviderConfig {
|
|
|
3905
3905
|
children: React.ReactNode;
|
|
3906
3906
|
[key: string]: unknown;
|
|
3907
3907
|
}>;
|
|
3908
|
-
props?:
|
|
3908
|
+
props?: Record<string, unknown>;
|
|
3909
3909
|
}
|
|
3910
3910
|
/**
|
|
3911
3911
|
* Test case for user interactions.
|
|
@@ -4122,14 +4122,14 @@ export interface MockIntersectionObserverEntry {
|
|
|
4122
4122
|
intersectionRatio: number;
|
|
4123
4123
|
boundingClientRect: DOMRect;
|
|
4124
4124
|
}
|
|
4125
|
-
export type ConfigObject =
|
|
4125
|
+
export type ConfigObject = Record<string, unknown>;
|
|
4126
4126
|
export type ConfigLoader = (env: string) => unknown;
|
|
4127
4127
|
export type EnvironmentTransformer = (env: EnvironmentConfig) => ConfigObject;
|
|
4128
4128
|
export type KeyboardUserInteraction = Pick<UserInteraction, 'keyboard'>;
|
|
4129
4129
|
export type FocusUserInteraction = Required<Pick<UserInteraction, 'keyboard' | 'tab'>>;
|
|
4130
4130
|
export type SkipLinkUserInteraction = Required<Pick<UserInteraction, 'click' | 'tab'>>;
|
|
4131
4131
|
export type AccessibilityAttributesMap = Record<string, string>;
|
|
4132
|
-
export type TestParameters =
|
|
4132
|
+
export type TestParameters = Record<string, unknown>;
|
|
4133
4133
|
export type TestMatrixInputs<T extends Record<string, UnknownArray>> = {
|
|
4134
4134
|
[K in keyof T]: T[K][];
|
|
4135
4135
|
};
|
|
@@ -4157,11 +4157,11 @@ export type UnknownFunction = (...args: unknown[]) => unknown;
|
|
|
4157
4157
|
* ```
|
|
4158
4158
|
*/
|
|
4159
4159
|
export interface SpyTargetConfig {
|
|
4160
|
-
obj:
|
|
4160
|
+
obj: Record<string, unknown>;
|
|
4161
4161
|
method: string;
|
|
4162
4162
|
implementation?: UnknownFunction;
|
|
4163
4163
|
}
|
|
4164
|
-
export type ModuleMockFactories = Record<string, () =>
|
|
4164
|
+
export type ModuleMockFactories = Record<string, () => Record<string, unknown>>;
|
|
4165
4165
|
/**
|
|
4166
4166
|
* Test case with setup function.
|
|
4167
4167
|
* Allows pre-test configuration.
|
|
@@ -4405,7 +4405,7 @@ export interface ServiceTestHarnessReturn<T> {
|
|
|
4405
4405
|
* ```
|
|
4406
4406
|
*/
|
|
4407
4407
|
export interface DynamicModuleClass {
|
|
4408
|
-
forRoot: (config: unknown) =>
|
|
4408
|
+
forRoot: (config: unknown) => Record<string, unknown>;
|
|
4409
4409
|
}
|
|
4410
4410
|
/**
|
|
4411
4411
|
* Expectations for dynamic module testing.
|
|
@@ -5137,7 +5137,7 @@ export interface LeakResult {
|
|
|
5137
5137
|
*/
|
|
5138
5138
|
export interface HookScenario extends Named {
|
|
5139
5139
|
action: () => Promisable<void>;
|
|
5140
|
-
expectedState:
|
|
5140
|
+
expectedState: Record<string, unknown>;
|
|
5141
5141
|
expectedError?: Error | null;
|
|
5142
5142
|
}
|
|
5143
5143
|
/**
|
|
@@ -5553,7 +5553,7 @@ export interface NextTestContext {
|
|
|
5553
5553
|
*/
|
|
5554
5554
|
export interface SSPContext extends Partial<MockGetServerSidePropsContext> {
|
|
5555
5555
|
scenario?: string;
|
|
5556
|
-
expectedProps?:
|
|
5556
|
+
expectedProps?: Record<string, unknown>;
|
|
5557
5557
|
expectedRedirect?: {
|
|
5558
5558
|
destination: string;
|
|
5559
5559
|
permanent?: boolean;
|
|
@@ -5566,7 +5566,7 @@ export interface SSPContext extends Partial<MockGetServerSidePropsContext> {
|
|
|
5566
5566
|
*/
|
|
5567
5567
|
export interface SPContext extends Partial<MockGetStaticPropsContext> {
|
|
5568
5568
|
scenario?: string;
|
|
5569
|
-
expectedProps?:
|
|
5569
|
+
expectedProps?: Record<string, unknown>;
|
|
5570
5570
|
expectedRevalidate?: number;
|
|
5571
5571
|
expectedRedirect?: {
|
|
5572
5572
|
destination: string;
|
|
@@ -5591,7 +5591,7 @@ export interface APIRequest extends Partial<WithHttpMethod>, Partial<WithHeaders
|
|
|
5591
5591
|
*/
|
|
5592
5592
|
export interface LifecycleScenario extends Named {
|
|
5593
5593
|
action: () => Promisable<void>;
|
|
5594
|
-
expectedState?:
|
|
5594
|
+
expectedState?: Record<string, unknown>;
|
|
5595
5595
|
expectedEvents?: string[];
|
|
5596
5596
|
}
|
|
5597
5597
|
/**
|
|
@@ -5705,7 +5705,7 @@ export type SignalHandler = (signal: Signal) => Promisable<void>;
|
|
|
5705
5705
|
* @type ComponentType
|
|
5706
5706
|
* @typeParam P - Props type
|
|
5707
5707
|
*/
|
|
5708
|
-
export type ComponentType<P =
|
|
5708
|
+
export type ComponentType<P = Record<string, unknown>> = new (props: P) => React.Component<P>;
|
|
5709
5709
|
/**
|
|
5710
5710
|
* Next.js Get Server-Side Props function
|
|
5711
5711
|
* @type GSSP
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
* @since 1.0.0
|
|
49
49
|
*/
|
|
50
50
|
import type * as React from 'react';
|
|
51
|
-
import type { UnknownRecord } from 'type-fest';
|
|
52
51
|
import type { RenderOptions, RenderHookOptions, MockNextRouter } from '..';
|
|
53
52
|
import type * as TestingLibraryReact from '@testing-library/react';
|
|
54
53
|
import type { Named, Resettable, WithTimestamp } from '../../../common/types';
|
|
@@ -124,7 +123,7 @@ export interface WrapperOptions {
|
|
|
124
123
|
children: React.ReactNode;
|
|
125
124
|
}>>;
|
|
126
125
|
/** Props to pass to the providers */
|
|
127
|
-
providerProps?:
|
|
126
|
+
providerProps?: Record<string, unknown>;
|
|
128
127
|
}
|
|
129
128
|
/**
|
|
130
129
|
* Extended render options combining RTL options with wrapper configuration.
|
|
@@ -730,7 +729,7 @@ export interface ProviderChainItem {
|
|
|
730
729
|
children: React.ReactNode;
|
|
731
730
|
}>;
|
|
732
731
|
/** Props to pass to provider */
|
|
733
|
-
props?:
|
|
732
|
+
props?: Record<string, unknown>;
|
|
734
733
|
}
|
|
735
734
|
/**
|
|
736
735
|
* Context value for subscribable providers.
|
|
@@ -937,7 +936,7 @@ export interface TimeTravelProviderReturn<T> {
|
|
|
937
936
|
* });
|
|
938
937
|
* ```
|
|
939
938
|
*/
|
|
940
|
-
export interface MockApiProviderReturn<T extends
|
|
939
|
+
export interface MockApiProviderReturn<T extends Record<string, unknown>> {
|
|
941
940
|
/** Mock API provider component */
|
|
942
941
|
Provider: React.FC<{
|
|
943
942
|
children: React.ReactNode;
|
|
@@ -199,7 +199,7 @@ export interface FeatureFlagFactory<FeatureFlagKey extends string> {
|
|
|
199
199
|
/** Create a number feature flag */
|
|
200
200
|
createNumber: (key: string, value: number, overrides?: Partial<FeatureFlag<FeatureFlagKey>>) => FeatureFlag<FeatureFlagKey>;
|
|
201
201
|
/** Create an object feature flag */
|
|
202
|
-
createObject: (key: string, value:
|
|
202
|
+
createObject: (key: string, value: Record<string, unknown>, overrides?: Partial<FeatureFlag<FeatureFlagKey>>) => FeatureFlag<FeatureFlagKey>;
|
|
203
203
|
}
|
|
204
204
|
/**
|
|
205
205
|
* Pre-defined feature flag scenario generators for common testing patterns
|
|
@@ -1256,7 +1256,7 @@ export interface TestFeatureFlagContextValue<FeatureFlagKey extends string> {
|
|
|
1256
1256
|
/** Force refresh flags */
|
|
1257
1257
|
refresh: () => Promise<void>;
|
|
1258
1258
|
/** Callback when provider is ready */
|
|
1259
|
-
onReady
|
|
1259
|
+
onReady?: () => void;
|
|
1260
1260
|
}
|
|
1261
1261
|
/**
|
|
1262
1262
|
* Options for waiting for flag value changes.
|
|
@@ -1604,7 +1604,7 @@ export interface CreateABTestScenario<T extends string> {
|
|
|
1604
1604
|
/** A/B test configuration */
|
|
1605
1605
|
config: ABTestConfig<T>;
|
|
1606
1606
|
/** Get variant for user */
|
|
1607
|
-
getVariantForUser: (userId: string, attributes?:
|
|
1607
|
+
getVariantForUser: (userId: string, attributes?: Record<string, unknown>) => FeatureFlagValue;
|
|
1608
1608
|
getTrafficDistribution: () => {
|
|
1609
1609
|
control: number;
|
|
1610
1610
|
treatment: number;
|
package/package.json
CHANGED