fix(test): await pending frontend module teardown
This commit is contained in:
1 parent
82e5756325
commit
6304335fcc
2 files changed
+5
-1
No files matched your search
@@ -85,9 +85,11 @@ beforeEach(() => {
|
||||
document.body.appendChild(root);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
afterEach(async () => {
|
||||
await flushUi();
|
||||
app?.unmount();
|
||||
app = null;
|
||||
await flushUi();
|
||||
root?.remove();
|
||||
root = null;
|
||||
document.body.innerHTML = "";
|
||||
|
||||
@@ -37,6 +37,7 @@ describe("connection root lookup", () => {
|
||||
// markConnectionLost → clearConnectionNodeLoading 经连接根查找定位节点:
|
||||
// 分组内的连接必须能被找到并清除 loading
|
||||
store.markConnectionLost("pg-1", new Error("connection lost"));
|
||||
await vi.dynamicImportSettled();
|
||||
expect(conn.isLoading).toBe(false);
|
||||
});
|
||||
|
||||
@@ -55,6 +56,7 @@ describe("connection root lookup", () => {
|
||||
(collidingDeepNode as { isLoading?: boolean }).isLoading = true;
|
||||
|
||||
store.markConnectionLost("pg-1", new Error("connection lost"));
|
||||
await vi.dynamicImportSettled();
|
||||
// 真正的连接根被清除 loading;深层碰撞节点不受影响
|
||||
expect(realRoot.isLoading).toBe(false);
|
||||
expect((collidingDeepNode as { isLoading?: boolean }).isLoading).toBe(true);
|
||||
|
||||
Reference in new issue
Block a user