mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 10:10:22 +00:00
test(perf): trim fixed waits in relay and startup tests
This commit is contained in:
@@ -71,6 +71,7 @@ describe("diffs plugin registration", () => {
|
||||
},
|
||||
pluginConfig: {
|
||||
defaults: {
|
||||
mode: "view",
|
||||
theme: "light",
|
||||
background: false,
|
||||
layout: "split",
|
||||
|
||||
@@ -48,18 +48,14 @@ describe("googlechatPlugin gateway.startAccount", () => {
|
||||
statusPatchSink: (next) => patches.push({ ...next }),
|
||||
}),
|
||||
);
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 20));
|
||||
|
||||
let settled = false;
|
||||
void task.then(() => {
|
||||
settled = true;
|
||||
});
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 20));
|
||||
await vi.waitFor(() => {
|
||||
expect(hoisted.startGoogleChatMonitor).toHaveBeenCalledOnce();
|
||||
});
|
||||
expect(settled).toBe(false);
|
||||
|
||||
expect(hoisted.startGoogleChatMonitor).toHaveBeenCalledOnce();
|
||||
expect(unregister).not.toHaveBeenCalled();
|
||||
|
||||
abort.abort();
|
||||
|
||||
@@ -115,16 +115,15 @@ describe("linePlugin gateway.startAccount", () => {
|
||||
}),
|
||||
);
|
||||
|
||||
// Allow async internals (probeLineBot await) to flush
|
||||
await new Promise((r) => setTimeout(r, 20));
|
||||
|
||||
expect(monitorLineProvider).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
channelAccessToken: "token",
|
||||
channelSecret: "secret",
|
||||
accountId: "default",
|
||||
}),
|
||||
);
|
||||
await vi.waitFor(() => {
|
||||
expect(monitorLineProvider).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
channelAccessToken: "token",
|
||||
channelSecret: "secret",
|
||||
accountId: "default",
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
abort.abort();
|
||||
await task;
|
||||
|
||||
@@ -48,17 +48,14 @@ describe("nextcloudTalkPlugin gateway.startAccount", () => {
|
||||
abortSignal: abort.signal,
|
||||
}),
|
||||
);
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 20));
|
||||
|
||||
let settled = false;
|
||||
void task.then(() => {
|
||||
settled = true;
|
||||
});
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 20));
|
||||
await vi.waitFor(() => {
|
||||
expect(hoisted.monitorNextcloudTalkProvider).toHaveBeenCalledOnce();
|
||||
});
|
||||
expect(settled).toBe(false);
|
||||
expect(hoisted.monitorNextcloudTalkProvider).toHaveBeenCalledOnce();
|
||||
expect(stop).not.toHaveBeenCalled();
|
||||
|
||||
abort.abort();
|
||||
|
||||
Reference in New Issue
Block a user