Skip to content

Commit 0678b12

Browse files
committed
Fix unknown return type warning
1 parent a7e044a commit 0678b12

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

client/src/components/__tests__/UploadRecipe.test.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { render, screen, fireEvent } from "@testing-library/react";
1+
import { render, screen, fireEvent, act } from "@testing-library/react";
22
import { vi } from "vitest";
33
import UploadRecipe from "../UploadRecipe";
44

@@ -27,7 +27,12 @@ describe("UploadRecipe Component", () => {
2727
expect(screen.getByLabelText("Upload Recipe PDF")).toBeInTheDocument();
2828
});
2929

30-
it("shows uploading state when file is selected", () => {
30+
it("shows uploading state when file is selected", async () => {
31+
mockFetch.mockResolvedValueOnce({
32+
ok: true,
33+
json: async () => ({}),
34+
});
35+
3136
render(<UploadRecipe />);
3237

3338
const fileInput = screen.getByLabelText(
@@ -37,7 +42,9 @@ describe("UploadRecipe Component", () => {
3742
type: "application/pdf",
3843
});
3944

40-
fireEvent.change(fileInput!, { target: { files: [file] } });
45+
await act(async () => {
46+
fireEvent.change(fileInput!, { target: { files: [file] } });
47+
});
4148

4249
// Check that fetch was called
4350
expect(mockFetch).toHaveBeenCalledWith("/api/genai/upload", {

0 commit comments

Comments
 (0)