refactor(agents): share OAuth file-lock mock factory (#108745)

This commit is contained in:
Peter Steinberger
2026-07-16 00:57:10 -07:00
committed by GitHub
parent e36f586325
commit 4d25ce0605

View File

@@ -5,17 +5,14 @@
*/
import { afterAll, vi } from "vitest";
vi.mock("../../infra/file-lock.js", () => ({
const fileLockPassthroughMock = vi.hoisted(() => ({
drainFileLockStateForTest: async () => undefined,
resetFileLockStateForTest: () => undefined,
withFileLock: async <T>(_filePath: string, _options: unknown, run: () => Promise<T>) => run(),
}));
vi.mock("../../plugin-sdk/file-lock.js", () => ({
drainFileLockStateForTest: async () => undefined,
resetFileLockStateForTest: () => undefined,
withFileLock: async <T>(_filePath: string, _options: unknown, run: () => Promise<T>) => run(),
}));
vi.mock("../../infra/file-lock.js", () => fileLockPassthroughMock);
vi.mock("../../plugin-sdk/file-lock.js", () => fileLockPassthroughMock);
afterAll(() => {
vi.doUnmock("../../infra/file-lock.js");