mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 20:20:43 +00:00
test: reuse nodes utils import
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const gatewayMocks = vi.hoisted(() => ({
|
||||
callGatewayTool: vi.fn(),
|
||||
@@ -8,9 +8,7 @@ vi.mock("./gateway.js", () => ({
|
||||
}));
|
||||
|
||||
import type { NodeListNode } from "./nodes-utils.js";
|
||||
|
||||
let listNodes: typeof import("./nodes-utils.js").listNodes;
|
||||
let resolveNodeIdFromList: typeof import("./nodes-utils.js").resolveNodeIdFromList;
|
||||
import { listNodes, resolveNodeIdFromList } from "./nodes-utils.js";
|
||||
|
||||
function node({ nodeId, ...overrides }: Partial<NodeListNode> & { nodeId: string }): NodeListNode {
|
||||
return {
|
||||
@@ -21,10 +19,6 @@ function node({ nodeId, ...overrides }: Partial<NodeListNode> & { nodeId: string
|
||||
};
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
({ listNodes, resolveNodeIdFromList } = await import("./nodes-utils.js"));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
gatewayMocks.callGatewayTool.mockReset();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user