import { injectable, type AssertionResult } from "@codemation/core"; @injectable() export class AssertionResultGuard { isAssertionResult(value: unknown): value is AssertionResult { if (typeof value !== "object" || value === null) return false; const candidate = value as Partial; if (typeof candidate.name !== "string") return false; if (typeof candidate.score !== "number" || Number.isNaN(candidate.score)) return false; if ( candidate.passThreshold !== undefined && (typeof candidate.passThreshold !== "number" || Number.isNaN(candidate.passThreshold)) ) { return false; } if (candidate.errored !== undefined && candidate.errored !== true) return false; return true; } }