UNPKG

@firfi/quint-connect

Version:

Model-based testing framework connecting Quint specifications to TypeScript implementations

62 lines 3.18 kB
import type { StandardSchemaV1 } from "@standard-schema/spec"; import type { RunOptions } from "./cli/quint.js"; import type { Config } from "./driver/types.js"; export type { RunOptions } from "./cli/quint.js"; export type { Config } from "./driver/types.js"; export { defaultConfig } from "./driver/types.js"; export { QuintError, QuintNotFoundError } from "./cli/quint.js"; export { NoTracesError, StateMismatchError, TraceReplayError } from "./runner/runner.js"; type PicksSchema = Record<string, StandardSchemaV1<any, any>>; type HandlerPicks<Fields extends PicksSchema> = { readonly [K in keyof Fields]: StandardSchemaV1.InferOutput<Fields[K]>; }; interface AnySimpleActionDefPicks { readonly picks: PicksSchema; } interface AnySimpleActionDefHandler { readonly handler: (picks: any) => void | Promise<void>; } type AnySimpleActionDef = AnySimpleActionDefPicks & AnySimpleActionDefHandler; export interface SimpleActionMap { readonly [action: string]: AnySimpleActionDef; } interface SimpleDriverActions<Actions extends SimpleActionMap> { readonly actions: Actions; } interface SimpleDriverHooks<S> { readonly getState?: () => S; readonly config?: () => Config; readonly step?: (action: string, nondetPicks: ReadonlyMap<string, unknown>) => void | Promise<void>; } export type SimpleDriver<S, Actions extends SimpleActionMap = SimpleActionMap> = SimpleDriverActions<Actions> & SimpleDriverHooks<S>; interface SimpleRunStateCheck<S> { readonly compareState: (spec: S, impl: S) => boolean; readonly deserializeState: (raw: unknown) => S; } export declare const stateCheck: <S>(deserializeState: (raw: unknown) => S, compareState: (spec: S, impl: S) => boolean) => SimpleRunStateCheck<S>; interface SimpleRunDriver<S, Actions extends SimpleActionMap> { readonly driver: () => SimpleDriver<S, Actions> | Promise<SimpleDriver<S, Actions>>; } interface SimpleRunOptionsExtra<S> { readonly stateCheck?: SimpleRunStateCheck<S> | undefined; readonly concurrency?: number | undefined; } export type SimpleRunOptions<S, Actions extends SimpleActionMap = SimpleActionMap> = RunOptions & SimpleRunDriver<S, Actions> & SimpleRunOptionsExtra<S>; export declare function defineDriver<S extends Record<string, Record<string, StandardSchemaV1<any, any>>>, State = unknown>(schema: S, factory: () => { [K in keyof S]: (picks: HandlerPicks<S[K]>) => void | Promise<void>; } & { getState?: () => State; config?: () => Config; }): () => SimpleDriver<State>; export declare function defineDriver<State = unknown>(factory: () => { step: (action: string, nondetPicks: ReadonlyMap<string, unknown>) => void | Promise<void>; getState?: () => State; config?: () => Config; }): () => SimpleDriver<State>; export declare const run: <S, Actions extends SimpleActionMap>(opts: SimpleRunOptions<S, Actions>) => Promise<{ readonly tracesReplayed: number; readonly seed: string; }>; export declare const pickFrom: <T>(nondetPicks: ReadonlyMap<string, unknown>, key: string, schema: StandardSchemaV1<unknown, T>) => T | undefined; export { transformITFValue } from "@firfi/itf-trace-parser"; //# sourceMappingURL=simple.d.ts.map