huskies: merge 622_story_wrap_react_state_updates_in_act_to_silence_frontend_test_warnings
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user