Showing the changes to apps/server/src/workspace/Layers/WorkspaceFileSystem.test.ts (1 of 19 files). Show all
Unified · Split
| @@ -8,20 +8,19 @@ import * as Path from "effect/Path"; · 7 unmodified lines | ||
| 8 | 8 | import { ServerConfig } from "../../config.ts"; |
| 9 | 9 | import * as VcsDriverRegistry from "../../vcs/VcsDriverRegistry.ts"; |
| 10 | 10 | import * as VcsProcess from "../../vcs/VcsProcess.ts"; |
| 11 | −import { WorkspaceEntries } from "../Services/WorkspaceEntries.ts"; | |
| 11 | +import * as WorkspaceEntries from "../WorkspaceEntries.ts"; | |
| 12 | 12 | import { WorkspaceFileSystem } from "../Services/WorkspaceFileSystem.ts"; |
| 13 | −import { WorkspaceEntriesLive } from "./WorkspaceEntries.ts"; | |
| 14 | 13 | import { WorkspaceFileSystemLive } from "./WorkspaceFileSystem.ts"; |
| 15 | 14 | import { WorkspacePathsLive } from "./WorkspacePaths.ts"; |
| 16 | 15 | |
| 17 | 16 | const ProjectLayer = WorkspaceFileSystemLive.pipe( |
| 18 | 17 | Layer.provide(WorkspacePathsLive), |
| 19 | − Layer.provide(WorkspaceEntriesLive.pipe(Layer.provide(WorkspacePathsLive))), | |
| 18 | + Layer.provide(WorkspaceEntries.layer.pipe(Layer.provide(WorkspacePathsLive))), | |
| 20 | 19 | ); |
| 21 | 20 | |
| 22 | 21 | const TestLayer = Layer.empty.pipe( |
| 23 | 22 | Layer.provideMerge(ProjectLayer), |
| 24 | − Layer.provideMerge(WorkspaceEntriesLive.pipe(Layer.provide(WorkspacePathsLive))), | |
| 23 | + Layer.provideMerge(WorkspaceEntries.layer.pipe(Layer.provide(WorkspacePathsLive))), | |
| 25 | 24 | Layer.provideMerge(WorkspacePathsLive), |
| 26 | 25 | Layer.provideMerge(VcsDriverRegistry.layer.pipe(Layer.provide(VcsProcess.layer))), |
| 27 | 26 | Layer.provide( |
| @@ -53,7 +52,7 @@ const writeTextFile = Effect.fn("writeTextFile")(function* ( · 25 unmodified lines | ||
| 53 | 52 | yield* fileSystem.writeFileString(absolutePath, contents).pipe(Effect.orDie); |
| 54 | 53 | }); |
| 55 | 54 | |
| 56 | −it.layer(TestLayer)("WorkspaceFileSystemLive", (it) => { | |
| 55 | +it.layer(TestLayer, { excludeTestServices: true })("WorkspaceFileSystemLive", (it) => { | |
| 57 | 56 | describe("readFile", () => { |
| 58 | 57 | it.effect("reads UTF-8 files relative to the workspace root", () => |
| 59 | 58 | Effect.gen(function* () { |
| @@ -135,20 +134,15 @@ it.layer(TestLayer)("WorkspaceFileSystemLive", (it) => { · 75 unmodified lines | ||
| 135 | 134 | |
| 136 | 135 | it.effect("invalidates workspace entry search cache after writes", () => |
| 137 | 136 | Effect.gen(function* () { |
| 138 | − const workspaceEntries = yield* WorkspaceEntries; | |
| 137 | + const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries; | |
| 139 | 138 | const workspaceFileSystem = yield* WorkspaceFileSystem; |
| 140 | 139 | const cwd = yield* makeTempDir; |
| 141 | 140 | yield* writeTextFile(cwd, "src/existing.ts", "export {};\n"); |
| 142 | 141 | |
| 143 | − const beforeWrite = yield* workspaceEntries.search({ | |
| 144 | − cwd, | |
| 145 | − query: "rpc", | |
| 146 | − limit: 10, | |
| 147 | − }); | |
| 148 | − expect(beforeWrite).toEqual({ | |
| 149 | − entries: [], | |
| 150 | − truncated: false, | |
| 151 | − }); | |
| 142 | + const beforeWrite = yield* workspaceEntries.list({ cwd }); | |
| 143 | + expect(beforeWrite.entries.some((entry) => entry.path === "plans/effect-rpc.md")).toBe( | |
| 144 | + false, | |
| 145 | + ); | |
| 152 | 146 | |
| 153 | 147 | yield* workspaceFileSystem.writeFile({ |
| 154 | 148 | cwd, |
| @@ -156,11 +150,7 @@ it.layer(TestLayer)("WorkspaceFileSystemLive", (it) => { · 1 unmodified line | ||
| 156 | 150 | contents: "# Plan\n", |
| 157 | 151 | }); |
| 158 | 152 | |
| 159 | − const afterWrite = yield* workspaceEntries.search({ | |
| 160 | − cwd, | |
| 161 | − query: "rpc", | |
| 162 | − limit: 10, | |
| 163 | − }); | |
| 153 | + const afterWrite = yield* workspaceEntries.list({ cwd }); | |
| 164 | 154 | expect(afterWrite.entries).toEqual( |
| 165 | 155 | expect.arrayContaining([expect.objectContaining({ path: "plans/effect-rpc.md" })]), |
| 166 | 156 | ); |