huskies: merge 622_story_wrap_react_state_updates_in_act_to_silence_frontend_test_warnings

This commit is contained in:
dave
2026-04-24 22:58:34 +00:00
parent e1bfbf4232
commit b70ee1aa4b
4 changed files with 83 additions and 73 deletions
@@ -138,7 +138,7 @@ describe("usePathCompletion hook", () => {
expect(result.current.matchList[0].name).toBe("Documents");
});
it("calls setPathInput when acceptMatch is invoked", () => {
it("calls setPathInput when acceptMatch is invoked", async () => {
const setPathInput = vi.fn();
const { result } = renderHook(() =>
@@ -151,7 +151,7 @@ describe("usePathCompletion hook", () => {
}),
);
act(() => {
await act(async () => {
result.current.acceptMatch("/home/user/Documents/");
});
@@ -308,14 +308,14 @@ describe("usePathCompletion hook", () => {
expect(result.current.matchList.length).toBe(2);
});
act(() => {
await act(async () => {
result.current.acceptSelectedMatch();
});
expect(setPathInput).toHaveBeenCalledWith("/home/user/Documents/");
});
it("acceptSelectedMatch does nothing when matchList is empty", () => {
it("acceptSelectedMatch does nothing when matchList is empty", async () => {
const setPathInput = vi.fn();
const { result } = renderHook(() =>
@@ -328,7 +328,7 @@ describe("usePathCompletion hook", () => {
}),
);
act(() => {
await act(async () => {
result.current.acceptSelectedMatch();
});
@@ -352,7 +352,7 @@ describe("usePathCompletion hook", () => {
expect(result.current.matchList.length).toBe(1);
});
act(() => {
await act(async () => {
result.current.closeSuggestions();
});
@@ -450,7 +450,7 @@ describe("usePathCompletion hook", () => {
expect(result.current.matchList.length).toBe(2);
});
act(() => {
await act(async () => {
result.current.setSelectedMatch(1);
});