// ets_tracing: off import * as T from "../../Effect/index.js" import * as E from "../../Either/index.js" import type * as TAM from "../TestAnnotationMap/index.js" import type { TestFailure } from "../TestFailure/index.js" import type { TestSuccess } from "../TestSuccess/index.js" export const ExecutedSpecCaseTypeId = Symbol.for( "@effect-ts/system/Testing/ExecutedSpecCase" ) export type ExecutedSpecCaseTypeId = typeof ExecutedSpecCaseTypeId export abstract class ExecutedSpecCase { readonly [ExecutedSpecCaseTypeId]: ExecutedSpecCaseTypeId = ExecutedSpecCaseTypeId; readonly [T._E]: () => E; readonly [T._A]: () => A map(f: (a: A) => B): ExecutedSpecCase { concreteExecutedSpecCase(this) switch (this._tag) { case "SuiteCase": { return new ExecutedSuiteCase(this.label, this.specs.map(f)) } case "TestCase": { return new ExecutedTestCase(this.label, this.test, this.annotations) } } } } export function concreteExecutedSpecCase( _: ExecutedSpecCase ): asserts _ is ExecutedSuiteCase | ExecutedTestCase { // } export class ExecutedSuiteCase extends ExecutedSpecCase { readonly _tag = "SuiteCase" constructor(readonly label: string, readonly specs: readonly A[]) { super() } } export class ExecutedTestCase extends ExecutedSpecCase { readonly _tag = "TestCase" constructor( readonly label: string, readonly test: E.Either, TestSuccess>, readonly annotations: TAM.TestAnnotationMap ) { super() } } export const SpecTypeId = Symbol.for("@effect-ts/system/Testing/Spec") export type SpecTypeId = typeof SpecTypeId /** * An `ExecutedSpec` is a spec that has been run to produce test results. */ export class ExecutedSpec { readonly [SpecTypeId]: SpecTypeId = SpecTypeId; readonly [T._E]: () => E constructor(readonly caseValue: ExecutedSpecCase>) {} }