t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/Neon/BranchScope.test.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

35 lines
1.3 KiB
TypeScript

import { resolveBranchScope, type BranchScope } from "@/Neon/BranchScope";
import { providers } from "@/Neon/Providers";
import * as Test from "@/Test/Alchemy";
import { expect } from "alchemy-test";
import * as Effect from "effect/Effect";
import * as Result from "effect/Result";
const { test } = Test.make({ providers: providers() });
test.provider(
"explicit branch scope and conflicting-scope rejection",
() =>
Effect.gen(function* () {
expect(
yield* resolveBranchScope({
branch: { projectId: "project", branchId: "branch" },
}),
).toEqual({ projectId: "project", branchId: "branch" });
// @ts-expect-error Scope alternatives are mutually exclusive, including for JavaScript callers at runtime.
const conflict: BranchScope = {
project: { projectId: "project" },
branch: { projectId: "project", branchId: "branch" },
};
expect(
Result.isFailure(
yield* resolveBranchScope(conflict).pipe(Effect.result),
),
).toBe(true);
expect(
// @ts-expect-error A scope declaration is required.
Result.isFailure(yield* resolveBranchScope({}).pipe(Effect.result)),
).toBe(true);
}),
{ tags: ["provider:neon", "provider:neon:branch", "live"] },
);