Showing the changes to apps/server/src/sourceControl/SourceControlRepositoryService.test.ts (1 of 59 files). Show all
Unified · Split
| @@ -6,14 +6,10 @@ import { ChildProcessSpawner } from "effect/unstable/process"; · 5 unmodified lines | ||
| 6 | 6 | import { GitCommandError, type SourceControlProviderError } from "@t3tools/contracts"; |
| 7 | 7 | |
| 8 | 8 | import { ServerConfig } from "../config.ts"; |
| 9 | −import { | |
| 10 | − GitVcsDriver, | |
| 11 | − type ExecuteGitResult, | |
| 12 | − type GitVcsDriverShape, | |
| 13 | −} from "../vcs/GitVcsDriver.ts"; | |
| 14 | −import { SourceControlProviderRegistry } from "./SourceControlProviderRegistry.ts"; | |
| 15 | −import type { SourceControlProviderShape } from "./SourceControlProvider.ts"; | |
| 16 | −import { SourceControlRepositoryService, layer } from "./SourceControlRepositoryService.ts"; | |
| 9 | +import * as GitVcsDriver from "../vcs/GitVcsDriver.ts"; | |
| 10 | +import type * as SourceControlProvider from "./SourceControlProvider.ts"; | |
| 11 | +import * as SourceControlProviderRegistry from "./SourceControlProviderRegistry.ts"; | |
| 12 | +import * as SourceControlRepositoryService from "./SourceControlRepositoryService.ts"; | |
| 17 | 13 | |
| 18 | 14 | const CLONE_URLS = { |
| 19 | 15 | nameWithOwner: "octocat/t3code", |
| @@ -22,8 +18,8 @@ const CLONE_URLS = { · 2 unmodified lines | ||
| 22 | 18 | }; |
| 23 | 19 | |
| 24 | 20 | function makeProvider( |
| 25 | − overrides: Partial<SourceControlProviderShape> = {}, | |
| 26 | −): SourceControlProviderShape { | |
| 21 | + overrides: Partial<SourceControlProvider.SourceControlProviderShape> = {}, | |
| 22 | +): SourceControlProvider.SourceControlProviderShape { | |
| 27 | 23 | const unsupported = (operation: string) => |
| 28 | 24 | Effect.die(`unexpected provider operation ${operation}`) as Effect.Effect< |
| 29 | 25 | never, |
| @@ -43,7 +39,7 @@ function makeProvider( · 13 unmodified lines | ||
| 43 | 39 | }; |
| 44 | 40 | } |
| 45 | 41 | |
| 46 | −function processOutput(): ExecuteGitResult { | |
| 42 | +function processOutput(): GitVcsDriver.ExecuteGitResult { | |
| 47 | 43 | return { |
| 48 | 44 | exitCode: ChildProcessSpawner.ExitCode(0), |
| 49 | 45 | stdout: "", |
| @@ -54,17 +50,17 @@ function processOutput(): ExecuteGitResult { · 4 unmodified lines | ||
| 54 | 50 | } |
| 55 | 51 | |
| 56 | 52 | function makeLayer(input: { |
| 57 | − readonly provider?: SourceControlProviderShape; | |
| 58 | − readonly git?: Partial<GitVcsDriverShape>; | |
| 53 | + readonly provider?: SourceControlProvider.SourceControlProviderShape; | |
| 54 | + readonly git?: Partial<GitVcsDriver.GitVcsDriverShape>; | |
| 59 | 55 | }) { |
| 60 | − return layer.pipe( | |
| 56 | + return SourceControlRepositoryService.layer.pipe( | |
| 61 | 57 | Layer.provide( |
| 62 | − Layer.mock(SourceControlProviderRegistry)({ | |
| 58 | + Layer.mock(SourceControlProviderRegistry.SourceControlProviderRegistry)({ | |
| 63 | 59 | get: () => Effect.succeed(input.provider ?? makeProvider()), |
| 64 | 60 | }), |
| 65 | 61 | ), |
| 66 | 62 | Layer.provide( |
| 67 | − Layer.mock(GitVcsDriver)({ | |
| 63 | + Layer.mock(GitVcsDriver.GitVcsDriver)({ | |
| 68 | 64 | execute: () => Effect.succeed(processOutput()), |
| 69 | 65 | ensureRemote: () => Effect.succeed("origin"), |
| 70 | 66 | pushCurrentBranch: () => |
| @@ -93,7 +89,7 @@ it.effect("looks up repositories through the requested provider without search", · 22 unmodified lines | ||
| 93 | 89 | }); |
| 94 | 90 | |
| 95 | 91 | return Effect.gen(function* () { |
| 96 | − const service = yield* SourceControlRepositoryService; | |
| 92 | + const service = yield* SourceControlRepositoryService.SourceControlRepositoryService; | |
| 97 | 93 | const result = yield* service.lookupRepository({ |
| 98 | 94 | provider: "github", |
| 99 | 95 | repository: "octocat/t3code", |
| @@ -115,7 +111,7 @@ it.effect("clones a looked-up repository into the requested destination", () => · 15 unmodified lines | ||
| 115 | 111 | const cloneCalls: Array<{ cwd: string; args: ReadonlyArray<string> }> = []; |
| 116 | 112 | |
| 117 | 113 | yield* Effect.gen(function* () { |
| 118 | − const service = yield* SourceControlRepositoryService; | |
| 114 | + const service = yield* SourceControlRepositoryService.SourceControlRepositoryService; | |
| 119 | 115 | const result = yield* service.cloneRepository({ |
| 120 | 116 | provider: "github", |
| 121 | 117 | repository: "octocat/t3code", |
| @@ -167,7 +163,7 @@ it.effect("publishes by creating the repository, adding a remote, and pushing up · 45 unmodified lines | ||
| 167 | 163 | }); |
| 168 | 164 | |
| 169 | 165 | return Effect.gen(function* () { |
| 170 | − const service = yield* SourceControlRepositoryService; | |
| 166 | + const service = yield* SourceControlRepositoryService.SourceControlRepositoryService; | |
| 171 | 167 | const result = yield* service.publishRepository({ |
| 172 | 168 | cwd: "/workspace", |
| 173 | 169 | provider: "github", |
| @@ -222,7 +218,7 @@ it.effect("publishes to the remote name returned by ensureRemote", () => { · 48 unmodified lines | ||
| 222 | 218 | const pushCalls: Array<{ cwd: string; remoteName: string | null | undefined }> = []; |
| 223 | 219 | |
| 224 | 220 | return Effect.gen(function* () { |
| 225 | − const service = yield* SourceControlRepositoryService; | |
| 221 | + const service = yield* SourceControlRepositoryService.SourceControlRepositoryService; | |
| 226 | 222 | const result = yield* service.publishRepository({ |
| 227 | 223 | cwd: "/workspace", |
| 228 | 224 | provider: "github", |
| @@ -258,7 +254,7 @@ it.effect("publishes to the remote name returned by ensureRemote", () => { · 29 unmodified lines | ||
| 258 | 254 | it.effect("publish succeeds with status remote_added when the local repo has no commits", () => { |
| 259 | 255 | let pushCalls = 0; |
| 260 | 256 | return Effect.gen(function* () { |
| 261 | − const service = yield* SourceControlRepositoryService; | |
| 257 | + const service = yield* SourceControlRepositoryService.SourceControlRepositoryService; | |
| 262 | 258 | const result = yield* service.publishRepository({ |
| 263 | 259 | cwd: "/workspace", |
| 264 | 260 | provider: "github", |