mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 13:44:58 +00:00
test: dedupe and optimize test suites
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ReadableStream } from "node:stream/web";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
import type { VoyageBatchOutputLine, VoyageBatchRequest } from "./batch-voyage.js";
|
||||
import type { VoyageEmbeddingClient } from "./embeddings-voyage.js";
|
||||
|
||||
@@ -10,6 +10,12 @@ vi.mock("../infra/retry.js", () => ({
|
||||
}));
|
||||
|
||||
describe("runVoyageEmbeddingBatches", () => {
|
||||
let runVoyageEmbeddingBatches: typeof import("./batch-voyage.js").runVoyageEmbeddingBatches;
|
||||
|
||||
beforeAll(async () => {
|
||||
({ runVoyageEmbeddingBatches } = await import("./batch-voyage.js"));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.resetAllMocks();
|
||||
vi.unstubAllGlobals();
|
||||
@@ -84,8 +90,6 @@ describe("runVoyageEmbeddingBatches", () => {
|
||||
body: stream,
|
||||
});
|
||||
|
||||
const { runVoyageEmbeddingBatches } = await import("./batch-voyage.js");
|
||||
|
||||
const results = await runVoyageEmbeddingBatches({
|
||||
client: mockClient,
|
||||
agentId: "agent-1",
|
||||
@@ -156,8 +160,6 @@ describe("runVoyageEmbeddingBatches", () => {
|
||||
|
||||
fetchMock.mockResolvedValueOnce({ ok: true, body: stream });
|
||||
|
||||
const { runVoyageEmbeddingBatches } = await import("./batch-voyage.js");
|
||||
|
||||
const results = await runVoyageEmbeddingBatches({
|
||||
client: mockClient,
|
||||
agentId: "a1",
|
||||
|
||||
Reference in New Issue
Block a user