1import * as GitHub from "@/GitHub";
2import * as Provider from "@/Provider";
3import * as Test from "@/Test/Alchemy";
4import { expect } from "alchemy-test";
5import * as Effect from "effect/Effect";
6import { MinimumLogLevel } from "effect/References";
7
8const { test } = Test.make({ providers: GitHub.providers() });
9
10const logLevel = Effect.provideService(
11 MinimumLogLevel,
12 process.env.DEBUG ? "Debug" : "Info",
13);
14
15// A GitHub Comment is keyed entirely by its parent {owner, repository,
16// issueNumber} plus a server-assigned commentId. GitHub only enumerates
17// comments *within* a specific issue/PR — there is no account- or repo-wide
18// API to list every comment without first knowing the issue/PR. So the
19// provider is non-listable and `list()` returns `[]`.
20test.provider(
21 "list returns [] for the non-listable Comment provider",
22 (stack) =>
23 Effect.gen(function* () {
24 yield* stack.destroy();
25
26 const provider = yield* Provider.findProvider(GitHub.Comment);
27 const all = yield* provider.list();
28 expect(all).toEqual([]);
29
30 yield* stack.destroy();
31 }).pipe(logLevel),
32 {
33 tags: ["provider:github", "provider:github:comment", "live"],
34 timeout: 120_000,
35 },
36);