UNPKG

@firfi/quint-connect

Version:

Model-based testing framework connecting Quint specifications to TypeScript implementations

19 lines 1.03 kB
import { Effect } from "effect"; import { stateMismatchError, TraceReplayError, withTraceReplayError } from "./replay-errors.js"; /** @internal */ export const checkReplayState = (opts) => Effect.gen(function* () { if (opts.driver.getState === undefined) { return yield* new TraceReplayError({ message: "stateCheck is provided but driver.getState is not defined; getState is required when stateCheck is provided", traceIndex: opts.context.traceIndex, stepIndex: opts.context.stepIndex, action: opts.context.action }); } const specState = yield* withTraceReplayError(opts.stateCheck.deserializeState(opts.step.specState), opts.context, (cause) => `Failed to deserialize spec state: ${String(cause)}`); const implState = yield* opts.driver.getState(); if (!opts.stateCheck.compareState(specState, implState)) { return yield* stateMismatchError(opts.context, opts.seed, specState, implState); } }); //# sourceMappingURL=state-check.js.map