huskies: merge 1120 story Silence intentional-error stderr in frontend tests so failures stand out
This commit is contained in:
@@ -227,6 +227,7 @@ describe("usePathCompletion hook", () => {
|
||||
});
|
||||
|
||||
it("sets completionError when listDirectoryAbsolute throws an Error", async () => {
|
||||
const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
|
||||
mockListDir.mockRejectedValue(new Error("Permission denied"));
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
@@ -242,9 +243,13 @@ describe("usePathCompletion hook", () => {
|
||||
await waitFor(() => {
|
||||
expect(result.current.completionError).toBe("Permission denied");
|
||||
});
|
||||
|
||||
expect(errorSpy).toHaveBeenCalledWith(new Error("Permission denied"));
|
||||
errorSpy.mockRestore();
|
||||
});
|
||||
|
||||
it("sets generic completionError when listDirectoryAbsolute throws a non-Error", async () => {
|
||||
const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
|
||||
mockListDir.mockRejectedValue("some string error");
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
@@ -262,6 +267,9 @@ describe("usePathCompletion hook", () => {
|
||||
"Failed to compute suggestion.",
|
||||
);
|
||||
});
|
||||
|
||||
expect(errorSpy).toHaveBeenCalledWith("some string error");
|
||||
errorSpy.mockRestore();
|
||||
});
|
||||
|
||||
it("clears suggestionTail when selected match path does not start with input", async () => {
|
||||
|
||||
Reference in New Issue
Block a user