mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 23:14:31 +00:00
test: dedupe fixtures and test harness setup
This commit is contained in:
27
src/gateway/gateway-connection.test-mocks.ts
Normal file
27
src/gateway/gateway-connection.test-mocks.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { vi } from "vitest";
|
||||
|
||||
export const loadConfigMock = vi.fn();
|
||||
export const resolveGatewayPortMock = vi.fn();
|
||||
export const pickPrimaryTailnetIPv4Mock = vi.fn();
|
||||
export const pickPrimaryLanIPv4Mock = vi.fn();
|
||||
|
||||
vi.mock("../config/config.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("../config/config.js")>();
|
||||
return {
|
||||
...actual,
|
||||
loadConfig: loadConfigMock,
|
||||
resolveGatewayPort: resolveGatewayPortMock,
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("../infra/tailnet.js", () => ({
|
||||
pickPrimaryTailnetIPv4: pickPrimaryTailnetIPv4Mock,
|
||||
}));
|
||||
|
||||
vi.mock("./net.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("./net.js")>();
|
||||
return {
|
||||
...actual,
|
||||
pickPrimaryLanIPv4: pickPrimaryLanIPv4Mock,
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user