@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 29 lines 1.24 KB
Raw
1 import { resolveBranchScope, type BranchScope } from "@alchemy.run/neon/BranchScope";
2 import { providers } from "@alchemy.run/neon/Providers";
3 import { expect } from "@alchemy.run/test";
4 import * as Test from "@alchemy.run/test/Alchemy";
5 import * as Effect from "effect/Effect";
6 import * as Result from "effect/Result";
7
8 const { test } = Test.make({ providers: providers() });
9
10 test.provider(
11 "explicit branch scope and conflicting-scope rejection",
12 () =>
13 Effect.gen(function* () {
14 expect(
15 yield* resolveBranchScope({ branch: { projectId: "project", branchId: "branch" } }),
16 ).toEqual({ projectId: "project", branchId: "branch" });
17 // @ts-expect-error Scope alternatives are mutually exclusive, including for JavaScript callers at runtime.
18 const conflict: BranchScope = {
19 project: { projectId: "project" },
20 branch: { projectId: "project", branchId: "branch" },
21 };
22 expect(Result.isFailure(yield* resolveBranchScope(conflict).pipe(Effect.result))).toBe(true);
23 expect(
24 // @ts-expect-error A scope declaration is required.
25 Result.isFailure(yield* resolveBranchScope({}).pipe(Effect.result)),
26 ).toBe(true);
27 }),
28 { tags: ["provider:neon", "provider:neon:branch", "live"] },
29 );