History

Use GitHubCliLive as default test layer

- Wire `it.layer` to `GitHubCliLive` in `GitHubCli.test.ts` - Remove redundant `Effect.provide(GitHubCliLive)` calls in individual tests

Julius Marminge committed 8 months ago

Commit de21f4d1 parent 442bc951 file · +5 −5Browse files

Unified · Split

apps/server/src/git/Layers/GitHubCli.test.ts+5−5
@@ -1,5 +1,5 @@
11 import { assert, it } from "@effect/vitest";
2−import { Effect, Layer } from "effect";
2+import { Effect } from "effect";
33 import { afterEach, expect, vi } from "vitest";
44
55 vi.mock("../../processRunner", () => ({
@@ -11,7 +11,7 @@ import { GitHubCli } from "../Services/GitHubCli.ts"; · 5 unmodified lines
1111 import { GitHubCliLive } from "./GitHubCli.ts";
1212
1313 const mockedRunProcess = vi.mocked(runProcess);
14−const layer = it.layer(Layer.empty);
14+const layer = it.layer(GitHubCliLive);
1515
1616 afterEach(() => {
1717 mockedRunProcess.mockReset();
@@ -49,7 +49,7 @@ layer("GitHubCliLive", (it) => { · 31 unmodified lines
4949 cwd: "/repo",
5050 reference: "#42",
5151 });
52− }).pipe(Effect.provide(GitHubCliLive));
52+ });
5353
5454 assert.deepStrictEqual(result, {
5555 number: 42,
@@ -96,7 +96,7 @@ layer("GitHubCliLive", (it) => { · 40 unmodified lines
9696 cwd: "/repo",
9797 repository: "octocat/codething-mvp",
9898 });
99− }).pipe(Effect.provide(GitHubCliLive));
99+ });
100100
101101 assert.deepStrictEqual(result, {
102102 nameWithOwner: "octocat/codething-mvp",
@@ -120,7 +120,7 @@ layer("GitHubCliLive", (it) => { · 17 unmodified lines
120120 cwd: "/repo",
121121 reference: "4888",
122122 });
123− }).pipe(Effect.provide(GitHubCliLive), Effect.flip);
123+ }).pipe(Effect.flip);
124124
125125 assert.equal(error.message.includes("Pull request not found"), true);
126126 }),