test: remove reload deferral wait

This commit is contained in:
Peter Steinberger
2026-05-06 08:33:02 +01:00
parent 3e0fcafb87
commit c5fcfa1b56

View File

@@ -466,7 +466,7 @@ describe("gateway hot reload", () => {
hoisted.providerManager.startChannel.mockClear();
hoisted.activeEmbeddedRunCount.value = 1;
embeddedRunMock.activeIds.add("reload-active");
const delay = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));
vi.useFakeTimers();
const reloadPromise = onHotReload?.(
{
changedPaths: ["channels.discord.token"],
@@ -486,16 +486,20 @@ describe("gateway hot reload", () => {
},
);
try {
await delay(550);
await Promise.resolve();
await vi.advanceTimersByTimeAsync(500);
expect(hoisted.providerManager.stopChannel).not.toHaveBeenCalled();
expect(hoisted.providerManager.startChannel).not.toHaveBeenCalled();
hoisted.activeEmbeddedRunCount.value = 0;
embeddedRunMock.activeIds.clear();
await vi.advanceTimersByTimeAsync(500);
await reloadPromise;
} finally {
hoisted.activeEmbeddedRunCount.value = 0;
embeddedRunMock.activeIds.clear();
await vi.advanceTimersByTimeAsync(500).catch(() => {});
vi.useRealTimers();
await reloadPromise?.catch(() => {});
}