testing.ts
This file
Path
packages/protocol/src/testing.ts
70 lines · 2.1 KiB · TypeScript
Last changed by
Add the code-browser, policy and drafting contracts, peeled tags and commit times on the port, and the AI bindingoscabrielbefore adoptionfc4691d
History of this fileTake it
The walk stopped after 200 commits: lines older than 878da37 point at it.
Merge build/420-release-downloads: the CLI installs from the platform itself, with no GitHub in the release pathoscabrielbefore adoption878da37
lines 1–35why, one step back1/**2 * Server sides for tests. Test code alone imports this module: other3 * workspaces through `@repo/protocol/testing`, protocol's own tests by4 * relative path. Nothing under any `src/` may.5 */6import { Effect, Layer } from "effect";78import { Contracts, EnvSchemaOf } from "./contracts.ts";9import { Handle } from "./ids.ts";10import { Authenticated, CurrentPrincipal, Person } from "./principal.ts";1112/** A server side that takes every call as `handle`, for tests with several people. */13export const asPerson = (handle: Handle): Layer.Layer<Authenticated> =>14 Layer.succeed(Authenticated, (effect) =>15 Effect.provideService(effect, CurrentPrincipal, Person.make({ handle }))16 );1718/** A server side that takes every call as one person, for tests about other things. */19export const asTester: Layer.Layer<Authenticated> = asPerson(20 Handle.make("tester")21);2223/** What a contract does when a test reaches one it did not set up. */24const uncalled = () =>25 Effect.die("This test calls only the contracts it sets up.");2627/**28 * A handler for every contract, none of which a test should reach. A test29 * merges the ones it is about over these, each with30 * `Contracts.toLayerHandler`: a later layer's handler wins.31 */32export const unanswered = Contracts.toLayer({33 claim: uncalled,34 credits: uncalled,35 decide: uncalled,Add the code-browser, policy and drafting contracts, peeled tags and commit times on the port, and the AI bindingoscabrielbefore adoptionfc4691d
line 36why, one step back36 draftAsk: uncalled,Merge build/420-release-downloads: the CLI installs from the platform itself, with no GitHub in the release pathoscabrielbefore adoption878da37
lines 37–48why, one step back37 // Keyed by the class: lint keeps "shape" out of code names.38 [EnvSchemaOf._tag]: uncalled,39 evidence: uncalled,40 finish: uncalled,41 flagAsk: uncalled,42 fork: uncalled,43 frontPage: uncalled,44 initProject: uncalled,45 land: uncalled,46 landing: uncalled,47 ledger: uncalled,48 listAsks: uncalled,Add the code-browser, policy and drafting contracts, peeled tags and commit times on the port, and the AI bindingoscabrielbefore adoptionfc4691d
line 49why, one step back49 listPaths: uncalled,Merge build/420-release-downloads: the CLI installs from the platform itself, with no GitHub in the release pathoscabrielbefore adoption878da37
line 50why, one step back50 listProjects: uncalled,Add the code-browser, policy and drafting contracts, peeled tags and commit times on the port, and the AI bindingoscabrielbefore adoptionfc4691d
lines 51–52why, one step back51 listRefs: uncalled,52 log: uncalled,Merge build/420-release-downloads: the CLI installs from the platform itself, with no GitHub in the release pathoscabrielbefore adoption878da37
line 53why, one step back53 openAsk: uncalled,Add the code-browser, policy and drafting contracts, peeled tags and commit times on the port, and the AI bindingoscabrielbefore adoptionfc4691d
line 54why, one step back54 projectPolicy: uncalled,Merge build/420-release-downloads: the CLI installs from the platform itself, with no GitHub in the release pathoscabrielbefore adoption878da37
line 55why, one step back55 proposeAsk: uncalled,Add the code-browser, policy and drafting contracts, peeled tags and commit times on the port, and the AI bindingoscabrielbefore adoptionfc4691d
lines 56–57why, one step back56 readFile: uncalled,57 readTree: uncalled,Merge build/420-release-downloads: the CLI installs from the platform itself, with no GitHub in the release pathoscabrielbefore adoption878da37
lines 58–60why, one step back58 release: uncalled,59 setEnv: uncalled,60 showAsk: uncalled,Add the code-browser, policy and drafting contracts, peeled tags and commit times on the port, and the AI bindingoscabrielbefore adoptionfc4691d
lines 61–62why, one step back61 showCommit: uncalled,62 showProposal: uncalled,Merge build/420-release-downloads: the CLI installs from the platform itself, with no GitHub in the release pathoscabrielbefore adoption878da37
lines 63–68why, one step back63 status: uncalled,64 submitAnswer: uncalled,65 today: uncalled,66 verdict: uncalled,67 vouch: uncalled,68 watch: uncalled,Add the code-browser, policy and drafting contracts, peeled tags and commit times on the port, and the AI bindingoscabrielbefore adoptionfc4691d
line 69why, one step back69 why: uncalled,Merge build/420-release-downloads: the CLI installs from the platform itself, with no GitHub in the release pathoscabrielbefore adoption878da37
line 70why, one step back70});