test: stabilize slow and flaky tests
This commit is contained in:
@@ -3,9 +3,7 @@ import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { DisconnectReason } from "@whiskeysockets/baileys";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.useFakeTimers();
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const rmMock = vi.spyOn(fs, "rm");
|
||||
|
||||
@@ -51,9 +49,13 @@ const { loginWeb } = await import("./login.js");
|
||||
|
||||
describe("loginWeb coverage", () => {
|
||||
beforeEach(() => {
|
||||
vi.useFakeTimers();
|
||||
vi.clearAllMocks();
|
||||
rmMock.mockClear();
|
||||
});
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it("restarts once when WhatsApp requests code 515", async () => {
|
||||
waitForWaConnection
|
||||
|
||||
Reference in New Issue
Block a user