perf(test): trim matrix directory reload churn

This commit is contained in:
Vincent Koc 2026-04-01 22:50:16 +09:00
parent da9ffad368
commit 38410705bf
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
const { matrixAuthedHttpClientCtorMock, requestJsonMock } = vi.hoisted(() => ({
matrixAuthedHttpClientCtorMock: vi.fn(),
@ -28,11 +28,13 @@ let resolveMatrixAuth: typeof import("./matrix/client.js").resolveMatrixAuth;
describe("matrix directory live", () => {
const cfg = { channels: { matrix: {} } };
beforeEach(async () => {
vi.resetModules();
beforeAll(async () => {
({ listMatrixDirectoryGroupsLive, listMatrixDirectoryPeersLive } =
await import("./directory-live.js"));
({ resolveMatrixAuth } = await import("./matrix/client.js"));
});
beforeEach(() => {
vi.mocked(resolveMatrixAuth).mockReset();
vi.mocked(resolveMatrixAuth).mockResolvedValue({
accountId: "assistant",