annotations.test.ts
This file
Path
packages/protocol/test/annotations.test.ts
28 lines · 886 bytes · TypeScript
Last changed by
Merge build/comments-cli-protocol-checks into mainoscabrielbefore adoptionc86204f
History of this fileTake it
The walk stopped after 200 commits: lines older than 678c8b8 point at it.
Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 1–28why, one step back1import { describe, expect, it } from "@effect/vitest";2import { Context } from "effect";34import { Description, Destructive } from "../src/annotations.ts";5import { Contracts } from "../src/contracts.ts";67const contracts = [...Contracts.requests.values()];89describe("every contract's annotations", () => {10 it("describe what the contract does", () => {11 const undescribed = contracts.flatMap((rpc) =>12 Context.get(rpc.annotations, Description).trim() === "" ? [rpc._tag] : []13 );1415 expect(contracts).not.toHaveLength(0);16 expect(undescribed).toStrictEqual([]);17 });1819 it("say whether the contract is destructive, never leaving it to the default", () => {20 const silent = contracts.flatMap((rpc) =>21 Context.getOrUndefined(rpc.annotations, Destructive) === undefined22 ? [rpc._tag]23 : []24 );2526 expect(silent).toStrictEqual([]);27 });28});