Elffuss BraidHub

kikocis/continue public

Update searchReplaceImpl.test.ts
Changeset21233e7db0357fba2c9e7f9ede0a18355a52710e314bdb7eda77bfab3a89aeae
AuthorPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-06-30 13:45 -07:00
CommitterPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-06-30 13:45 -07:00
Parentse841ee848161

Browse the files at this changeset

1 file changed

modified gui/src/util/clientTools/searchReplaceImpl.test.ts +10 −15
@@ -9,6 +9,9 @@
99 vi.mock("core/edit/searchAndReplace/findSearchMatch");
1010 vi.mock("core/edit/searchAndReplace/parseSearchReplaceBlock");
1111 vi.mock("core/util/ideUtils");
12+vi.mock("uuid", () => ({
13+ v4: vi.fn(() => "test-stream-id"),
14+}));
1215
1316 const mockFindSearchMatch = vi.mocked(findSearchMatch);
1417 const mockParseAllSearchReplaceBlocks = vi.mocked(parseAllSearchReplaceBlocks);
@@ -39,21 +42,6 @@
3942 });
4043
4144 describe("basic validation", () => {
42- it("should throw error when no streamId is provided", async () => {
43- const extrasWithoutStreamId = {
44- ...mockExtras,
45- streamId: undefined,
46- };
47-
48- await expect(
49- searchReplaceToolImpl(
50- { filepath: "test.txt", diff: "some diff" },
51- "tool-call-id",
52- extrasWithoutStreamId,
53- ),
54- ).rejects.toThrow("Invalid apply state - no streamId available");
55- });
56-
5745 it("should throw error when file does not exist", async () => {
5846 mockResolveRelativePathInDir.mockResolvedValue(undefined);
5947
@@ -132,6 +120,7 @@
132120 streamId: "test-stream-id",
133121 filepath: "/resolved/path/test.js",
134122 toolCallId: "tool-call-id",
123+ isSearchAndReplace: true,
135124 });
136125 });
137126 });
@@ -222,6 +211,7 @@
222211 streamId: "test-stream-id",
223212 filepath: "/resolved/path/test.js",
224213 toolCallId: "tool-call-id",
214+ isSearchAndReplace: true,
225215 });
226216 });
227217 });
@@ -268,6 +258,7 @@
268258 streamId: "test-stream-id",
269259 filepath: "/resolved/path/test.txt",
270260 toolCallId: "tool-call-id",
261+ isSearchAndReplace: true,
271262 });
272263 });
273264
@@ -301,6 +292,7 @@
301292 streamId: "test-stream-id",
302293 filepath: "/resolved/path/test.txt",
303294 toolCallId: "tool-call-id",
295+ isSearchAndReplace: true,
304296 });
305297 });
306298 });
@@ -445,6 +437,7 @@
445437 streamId: "test-stream-id",
446438 filepath: "/resolved/path/test.txt",
447439 toolCallId: "tool-call-id",
440+ isSearchAndReplace: true,
448441 });
449442 });
450443
@@ -478,6 +471,7 @@
478471 streamId: "test-stream-id",
479472 filepath: "/resolved/path/test.txt",
480473 toolCallId: "tool-call-id",
474+ isSearchAndReplace: true,
481475 });
482476 });
483477 });
@@ -524,6 +518,7 @@
524518 streamId: "test-stream-id",
525519 filepath: "/resolved/path/test.txt",
526520 toolCallId: "tool-call-id",
521+ isSearchAndReplace: true,
527522 });
528523 });
529524 });