refactor: waitFor→findBy 替换 + renderWithBasicProviders + jsdom 条件化回退
This commit is contained in:
@@ -74,12 +74,7 @@ describe("Workbench 路由", () => {
|
||||
initialRoute: `/workbench/${MOCK_PROJECT.id}`,
|
||||
});
|
||||
|
||||
await waitFor(
|
||||
() => {
|
||||
expect(screen.getByText("返回管理台")).not.toBeNull();
|
||||
},
|
||||
{ timeout: 10000 },
|
||||
);
|
||||
await screen.findByText("返回管理台", {}, { timeout: 10000 });
|
||||
});
|
||||
|
||||
test("不存在项目显示不可访问", async () => {
|
||||
@@ -89,12 +84,7 @@ describe("Workbench 路由", () => {
|
||||
initialRoute: "/workbench/nonexistent-id",
|
||||
});
|
||||
|
||||
await waitFor(
|
||||
() => {
|
||||
expect(screen.getByText("项目不存在或不可访问")).not.toBeNull();
|
||||
},
|
||||
{ timeout: 10000 },
|
||||
);
|
||||
await screen.findByText("项目不存在或不可访问", {}, { timeout: 10000 });
|
||||
});
|
||||
|
||||
test("archived 项目显示不可访问", async () => {
|
||||
@@ -104,12 +94,7 @@ describe("Workbench 路由", () => {
|
||||
initialRoute: `/workbench/${MOCK_PROJECT.id}`,
|
||||
});
|
||||
|
||||
await waitFor(
|
||||
() => {
|
||||
expect(screen.getByText("项目不存在或不可访问")).not.toBeNull();
|
||||
},
|
||||
{ timeout: 10000 },
|
||||
);
|
||||
await screen.findByText("项目不存在或不可访问", {}, { timeout: 10000 });
|
||||
});
|
||||
|
||||
test("Workbench 显示聊天室菜单", async () => {
|
||||
@@ -119,12 +104,7 @@ describe("Workbench 路由", () => {
|
||||
initialRoute: `/workbench/${MOCK_PROJECT.id}`,
|
||||
});
|
||||
|
||||
await waitFor(
|
||||
() => {
|
||||
expect(screen.getByText("聊天室")).not.toBeNull();
|
||||
},
|
||||
{ timeout: 10000 },
|
||||
);
|
||||
await screen.findByText("聊天室", {}, { timeout: 10000 });
|
||||
});
|
||||
|
||||
test("Workbench 收集箱路由可达", async () => {
|
||||
@@ -134,12 +114,7 @@ describe("Workbench 路由", () => {
|
||||
initialRoute: `/workbench/${MOCK_PROJECT.id}/inbox`,
|
||||
});
|
||||
|
||||
await waitFor(
|
||||
() => {
|
||||
expect(screen.getByText("新增素材")).not.toBeNull();
|
||||
},
|
||||
{ timeout: 10000 },
|
||||
);
|
||||
await screen.findByText("新增素材", {}, { timeout: 10000 });
|
||||
});
|
||||
|
||||
test("Workbench 显示收集箱菜单", async () => {
|
||||
@@ -149,11 +124,6 @@ describe("Workbench 路由", () => {
|
||||
initialRoute: `/workbench/${MOCK_PROJECT.id}`,
|
||||
});
|
||||
|
||||
await waitFor(
|
||||
() => {
|
||||
expect(screen.getByText("收集箱")).not.toBeNull();
|
||||
},
|
||||
{ timeout: 10000 },
|
||||
);
|
||||
await screen.findByText("收集箱", {}, { timeout: 10000 });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user