@firfi/quint-connect
Version:
Model-based testing framework connecting Quint specifications to TypeScript implementations
18 lines • 1.05 kB
JavaScript
import { Schema, SchemaGetter } from "effect";
import { ITFVariant, UntypedTraceSchema } from "@firfi/itf-trace-parser/effect";
export { ITFBigInt, ITFList, ITFMap, ITFSet, ITFTuple, ITFUnserializable, ITFVariant, UntypedTraceSchema } from "@firfi/itf-trace-parser/effect";
// Quint encodes nondet picks as Option variants:
// Some(x) = { tag: "Some", value: x }
// None = { tag: "None", value: { "#tup": [] } }
export const ItfOption = (inner) => ITFVariant({ Some: inner, None: Schema.Unknown }).pipe(Schema.decodeTo(Schema.UndefinedOr(Schema.toType(inner)), {
decode: SchemaGetter.transform((variant) => variant.tag === "Some" ? variant.value : undefined),
encode: SchemaGetter.transform((value) => value !== undefined
? { tag: "Some", value }
: { tag: "None", value: { "#tup": [] } })
}));
export const MbtMeta = Schema.Struct({
"mbt::actionTaken": Schema.String,
"mbt::nondetPicks": Schema.Record(Schema.String, Schema.Unknown)
});
export const ItfTrace = UntypedTraceSchema;
//# sourceMappingURL=schema.js.map