Changesets · Branches · Tags · Compare
| Changeset | 21233e7db0357fba2c9e7f9ede0a18355a52710e314bdb7eda77bfab3a89aeae |
|---|---|
| Author | Patrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-06-30 13:45 -07:00 |
| Committer | Patrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-06-30 13:45 -07:00 |
| Parents | e841ee848161 |
1 file changed
modified gui/src/util/clientTools/searchReplaceImpl.test.ts +10 −15
| @@ -9,6 +9,9 @@ | ||
| 9 | 9 | vi.mock("core/edit/searchAndReplace/findSearchMatch"); |
| 10 | 10 | vi.mock("core/edit/searchAndReplace/parseSearchReplaceBlock"); |
| 11 | 11 | vi.mock("core/util/ideUtils"); |
| 12 | +vi.mock("uuid", () => ({ | |
| 13 | + v4: vi.fn(() => "test-stream-id"), | |
| 14 | +})); | |
| 12 | 15 | |
| 13 | 16 | const mockFindSearchMatch = vi.mocked(findSearchMatch); |
| 14 | 17 | const mockParseAllSearchReplaceBlocks = vi.mocked(parseAllSearchReplaceBlocks); |
| @@ -39,21 +42,6 @@ | ||
| 39 | 42 | }); |
| 40 | 43 | |
| 41 | 44 | 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 | - | |
| 57 | 45 | it("should throw error when file does not exist", async () => { |
| 58 | 46 | mockResolveRelativePathInDir.mockResolvedValue(undefined); |
| 59 | 47 | |
| @@ -132,6 +120,7 @@ | ||
| 132 | 120 | streamId: "test-stream-id", |
| 133 | 121 | filepath: "/resolved/path/test.js", |
| 134 | 122 | toolCallId: "tool-call-id", |
| 123 | + isSearchAndReplace: true, | |
| 135 | 124 | }); |
| 136 | 125 | }); |
| 137 | 126 | }); |
| @@ -222,6 +211,7 @@ | ||
| 222 | 211 | streamId: "test-stream-id", |
| 223 | 212 | filepath: "/resolved/path/test.js", |
| 224 | 213 | toolCallId: "tool-call-id", |
| 214 | + isSearchAndReplace: true, | |
| 225 | 215 | }); |
| 226 | 216 | }); |
| 227 | 217 | }); |
| @@ -268,6 +258,7 @@ | ||
| 268 | 258 | streamId: "test-stream-id", |
| 269 | 259 | filepath: "/resolved/path/test.txt", |
| 270 | 260 | toolCallId: "tool-call-id", |
| 261 | + isSearchAndReplace: true, | |
| 271 | 262 | }); |
| 272 | 263 | }); |
| 273 | 264 | |
| @@ -301,6 +292,7 @@ | ||
| 301 | 292 | streamId: "test-stream-id", |
| 302 | 293 | filepath: "/resolved/path/test.txt", |
| 303 | 294 | toolCallId: "tool-call-id", |
| 295 | + isSearchAndReplace: true, | |
| 304 | 296 | }); |
| 305 | 297 | }); |
| 306 | 298 | }); |
| @@ -445,6 +437,7 @@ | ||
| 445 | 437 | streamId: "test-stream-id", |
| 446 | 438 | filepath: "/resolved/path/test.txt", |
| 447 | 439 | toolCallId: "tool-call-id", |
| 440 | + isSearchAndReplace: true, | |
| 448 | 441 | }); |
| 449 | 442 | }); |
| 450 | 443 | |
| @@ -478,6 +471,7 @@ | ||
| 478 | 471 | streamId: "test-stream-id", |
| 479 | 472 | filepath: "/resolved/path/test.txt", |
| 480 | 473 | toolCallId: "tool-call-id", |
| 474 | + isSearchAndReplace: true, | |
| 481 | 475 | }); |
| 482 | 476 | }); |
| 483 | 477 | }); |
| @@ -524,6 +518,7 @@ | ||
| 524 | 518 | streamId: "test-stream-id", |
| 525 | 519 | filepath: "/resolved/path/test.txt", |
| 526 | 520 | toolCallId: "tool-call-id", |
| 521 | + isSearchAndReplace: true, | |
| 527 | 522 | }); |
| 528 | 523 | }); |
| 529 | 524 | }); |