mirror of https://github.com/openclaw/openclaw.git
perf(test): trim more matrix and telegram reload churn
This commit is contained in:
parent
dd5bf6b1d0
commit
e1b6c9b29b
|
|
@ -1,4 +1,4 @@
|
|||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
createMockMatrixClient,
|
||||
expectExplicitMatrixClientConfig,
|
||||
|
|
@ -38,10 +38,12 @@ let withResolvedMatrixControlClient: typeof import("./client.js").withResolvedMa
|
|||
let withResolvedMatrixSendClient: typeof import("./client.js").withResolvedMatrixSendClient;
|
||||
|
||||
describe("matrix send client helpers", () => {
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
beforeAll(async () => {
|
||||
({ withResolvedMatrixControlClient, withResolvedMatrixSendClient } =
|
||||
await import("./client.js"));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
primeMatrixClientResolverMocks({
|
||||
resolved: {},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { beforeAll, describe, expect, it, vi } from "vitest";
|
||||
let API_CONSTANTS: typeof import("grammy").API_CONSTANTS;
|
||||
let DEFAULT_TELEGRAM_UPDATE_TYPES: typeof import("./allowed-updates.js").DEFAULT_TELEGRAM_UPDATE_TYPES;
|
||||
let resolveTelegramAllowedUpdates: typeof import("./allowed-updates.js").resolveTelegramAllowedUpdates;
|
||||
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
beforeAll(async () => {
|
||||
({ API_CONSTANTS } = await import("grammy"));
|
||||
({ DEFAULT_TELEGRAM_UPDATE_TYPES, resolveTelegramAllowedUpdates } =
|
||||
await import("./allowed-updates.js"));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
let collectTelegramUnmentionedGroupIds: typeof import("./audit.js").collectTelegramUnmentionedGroupIds;
|
||||
let auditTelegramGroupMembership: typeof import("./audit.js").auditTelegramGroupMembership;
|
||||
|
|
@ -33,14 +33,16 @@ async function auditSingleGroup() {
|
|||
}
|
||||
|
||||
describe("telegram audit", () => {
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
beforeAll(async () => {
|
||||
vi.doMock("./fetch.js", () => ({
|
||||
resolveTelegramApiBase: resolveTelegramApiBaseMock,
|
||||
resolveTelegramFetch: resolveTelegramFetchMock,
|
||||
}));
|
||||
({ collectTelegramUnmentionedGroupIds, auditTelegramGroupMembership } =
|
||||
await import("./audit.js"));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fetchWithTimeoutMock.mockReset();
|
||||
resolveTelegramFetchMock.mockClear();
|
||||
resolveTelegramApiBaseMock.mockClear();
|
||||
|
|
|
|||
Loading…
Reference in New Issue