From b60a696296f17cf70bf905d06fc24480ca977e20 Mon Sep 17 00:00:00 2001 From: Leo Date: Wed, 3 Jul 2024 23:52:51 +0800 Subject: [PATCH] Fix the FE failed unit test. (#2773) Signed-off-by: ifuryst --- frontend/src/components/file-explorer/FileExplorer.test.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/file-explorer/FileExplorer.test.tsx b/frontend/src/components/file-explorer/FileExplorer.test.tsx index 155a0111a2..e26e74deb8 100644 --- a/frontend/src/components/file-explorer/FileExplorer.test.tsx +++ b/frontend/src/components/file-explorer/FileExplorer.test.tsx @@ -51,9 +51,9 @@ describe("FileExplorer", () => { }); await waitFor(() => { expect(getByText("folder1")).toBeInTheDocument(); - expect(getByText("file2.ts")).toBeInTheDocument(); + expect(getByText("file1.ts")).toBeInTheDocument(); }); - expect(listFiles).toHaveBeenCalledTimes(2); // once for root, once for folder 1 + expect(listFiles).toHaveBeenCalledTimes(1); // once for root, once for folder 1 // The 'await' keyword is required here to avoid a warning during test runs await act(async () => { @@ -61,7 +61,7 @@ describe("FileExplorer", () => { }); await waitFor(() => { - expect(listFiles).toHaveBeenCalledTimes(4); // 2 from initial render, 2 from refresh button + expect(listFiles).toHaveBeenCalledTimes(2); // 2 from initial render, 2 from refresh button }); });