| author | |
| committer | |
| log | 60c9ca0e33dcb30c9c8348b37615a10615fc4e5f |
| tree | a75b8aec34f4f1af53599f81fde432418b6d598e |
| parent | ad2cb1dd57dbdb028f6544ad780df4616ed41437 |
| signature | Signed by PGP key B5690EEEBB952194 |
Co-authored-by: codex <codex@users.noreply.github.com>2 files changed, 24 insertions(+), 4 deletions(-)
apps/server/src/checkpointing/CheckpointStore.test.ts+21| ... | @@ -93,6 +93,27 @@ function buildLargeText(lineCount = 5_000): string { | ... | @@ -93,6 +93,27 @@ function buildLargeText(lineCount = 5_000): string { |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | it.layer(TestLayer)("CheckpointStore.layer", (it) => { | 95 | it.layer(TestLayer)("CheckpointStore.layer", (it) => { |
| 96 | describe("isGitRepository", () => { | ||
| 97 | it.effect("returns false when no Git repository is detected", () => | ||
| 98 | Effect.gen(function* () { | ||
| 99 | const tmp = yield* makeTmpDir(); | ||
| 100 | const checkpointStore = yield* CheckpointStore.CheckpointStore; | ||
| 101 | |||
| 102 | expect(yield* checkpointStore.isGitRepository(tmp)).toBe(false); | ||
| 103 | }), | ||
| 104 | ); | ||
| 105 | |||
| 106 | it.effect("returns true when a Git repository is detected", () => | ||
| 107 | Effect.gen(function* () { | ||
| 108 | const tmp = yield* makeTmpDir(); | ||
| 109 | yield* initRepoWithCommit(tmp); | ||
| 110 | const checkpointStore = yield* CheckpointStore.CheckpointStore; | ||
| 111 | |||
| 112 | expect(yield* checkpointStore.isGitRepository(tmp)).toBe(true); | ||
| 113 | }), | ||
| 114 | ); | ||
| 115 | }); | ||
| 116 | |||
| 96 | describe("diffCheckpoints", () => { | 117 | describe("diffCheckpoints", () => { |
| 97 | it.effect("returns full oversized checkpoint diffs without truncation", () => | 118 | it.effect("returns full oversized checkpoint diffs without truncation", () => |
| 98 | Effect.gen(function* () { | 119 | Effect.gen(function* () { |
apps/server/src/checkpointing/CheckpointStore.ts+3-4| ... | @@ -115,10 +115,9 @@ export const make = Effect.gen(function* () { | ... | @@ -115,10 +115,9 @@ export const make = Effect.gen(function* () { |
| 115 | }); | 115 | }); |
| 116 | 116 | ||
| 117 | const isGitRepository: CheckpointStore["Service"]["isGitRepository"] = (cwd) => | 117 | const isGitRepository: CheckpointStore["Service"]["isGitRepository"] = (cwd) => |
| 118 | vcsRegistry.resolve({ cwd, requestedKind: "git" }).pipe( | 118 | vcsRegistry |
| 119 | Effect.map(() => true), | 119 | .detect({ cwd, requestedKind: "git" }) |
| 120 | Effect.orElseSucceed(() => false), | 120 | .pipe(Effect.map((repository) => repository !== null)); |
| 121 | ); | ||
| 122 | 121 | ||
| 123 | const captureCheckpoint: CheckpointStore["Service"]["captureCheckpoint"] = Effect.fn( | 122 | const captureCheckpoint: CheckpointStore["Service"]["captureCheckpoint"] = Effect.fn( |
| 124 | "captureCheckpoint", | 123 | "captureCheckpoint", |