avo-inspector
Version:
[](https://badge.fury.io/js/avo-inspector)
69 lines (68 loc) • 3.56 kB
TypeScript
/**
* Shared mock factories for testing event spec related functionality.
* These helpers reduce duplication across test files.
*/
import type { PropertyConstraints, EventSpecEntry, EventSpecResponse, EventSpecMetadata } from "../../eventSpec/AvoEventSpecFetchTypes";
/**
* Creates a PropertyConstraints with defaults.
*/
export declare function createPropertyConstraints(overrides?: Partial<PropertyConstraints>): PropertyConstraints;
/**
* Creates a property with pinned values constraint.
* pinnedValues maps each exact value to the eventIds that require it.
*/
export declare function createPinnedValueProperty(pinnedValues: Record<string, string[]>, extraOverrides?: Partial<PropertyConstraints>): PropertyConstraints;
/**
* Creates a property with allowed values constraint.
* allowedValues maps each JSON array string to the eventIds that accept those values.
*/
export declare function createAllowedValuesProperty(allowedValues: Record<string, string[]>, extraOverrides?: Partial<PropertyConstraints>): PropertyConstraints;
/**
* Creates a property with regex pattern constraint.
* regexPatterns maps each pattern to the eventIds that require matching.
*/
export declare function createRegexProperty(regexPatterns: Record<string, string[]>, extraOverrides?: Partial<PropertyConstraints>): PropertyConstraints;
/**
* Creates a property with min/max range constraint.
* minMaxRanges maps each "min,max" string to the eventIds that require that range.
*/
export declare function createMinMaxProperty(minMaxRanges: Record<string, string[]>, extraOverrides?: Partial<PropertyConstraints>): PropertyConstraints;
/**
* Creates an EventSpecEntry with defaults.
*/
export declare function createEventSpecEntry(overrides?: Partial<EventSpecEntry>): EventSpecEntry;
/**
* Creates an event with variants.
*/
export declare function createEventWithVariants(baseEventId: string, variantIds: string[], props?: Record<string, PropertyConstraints>): EventSpecEntry;
/**
* Creates EventSpecMetadata with defaults.
*/
export declare function createEventSpecMetadata(overrides?: Partial<EventSpecMetadata>): EventSpecMetadata;
/**
* Creates an EventSpecResponse with defaults.
*/
export declare function createEventSpecResponse(events?: EventSpecEntry[], metadataOverrides?: Partial<EventSpecMetadata>): EventSpecResponse;
/**
* Creates a simple EventSpecResponse with one event for basic testing.
*/
export declare function createSimpleEventSpecResponse(baseEventId?: string, variantIds?: string[]): EventSpecResponse;
/**
* Creates an EventSpecResponse with multiple events (simulating name-mapped events).
*/
export declare function createMultiEventSpecResponse(): EventSpecResponse;
/**
* Creates a property with nested children constraints (single object).
* children maps each child property name to its PropertyConstraints.
*/
export declare function createNestedProperty(children: Record<string, PropertyConstraints>, extraOverrides?: Partial<PropertyConstraints>): PropertyConstraints;
/**
* Creates a list property (array of items).
* For list of primitives: pass constraints like allowedValues, minMaxRanges, etc.
* For list of objects: pass children constraints.
*/
export declare function createListProperty(extraOverrides?: Partial<PropertyConstraints>): PropertyConstraints;
/**
* Creates a list of objects property with children constraints.
*/
export declare function createListOfObjectsProperty(children: Record<string, PropertyConstraints>, extraOverrides?: Partial<PropertyConstraints>): PropertyConstraints;