Open History to see the last commit
1import { describe, expect, it } from "@effect/vitest";
2import * as Cause from "effect/Cause";
3import * as Schema from "effect/Schema";
4
5import { squashAtomCommandFailure } from "../state/runtime.ts";
6import { thrownErrorMessage } from "./translatable.ts";
7
8const decodeDefect = Schema.decodeUnknownSync(Schema.Defect());
9
10describe("thrownErrorMessage", () => {
11 it("shows the text of a string defect that came back over RPC", () => {
12 const defect = decodeDefect(
13 "RPC contract is registered but unavailable in the control plane: projectClone.start",
14 );
15 const error = squashAtomCommandFailure({ cause: Cause.die(defect) });
16
17 expect(thrownErrorMessage(error)).toBe(
18 "RPC contract is registered but unavailable in the control plane: projectClone.start",
19 );
20 });
21});