mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 09:02:45 +00:00
refactor(test): dedupe agent and discord test fixtures
This commit is contained in:
@@ -5,22 +5,19 @@ import {
|
||||
loadSanitizeSessionHistoryWithCleanMocks,
|
||||
makeMockSessionManager,
|
||||
makeSimpleUserMessages,
|
||||
makeSnapshotChangedOpenAIReasoningScenario,
|
||||
sanitizeSnapshotChangedOpenAIReasoning,
|
||||
sanitizeWithOpenAIResponses,
|
||||
} from "./pi-embedded-runner.sanitize-session-history.test-harness.js";
|
||||
|
||||
vi.mock("./pi-embedded-helpers.js", async () => ({
|
||||
...(await vi.importActual("./pi-embedded-helpers.js")),
|
||||
isGoogleModelApi: vi.fn(),
|
||||
sanitizeSessionMessagesImages: vi.fn(async (msgs) => msgs),
|
||||
}));
|
||||
|
||||
type SanitizeSessionHistory = Awaited<ReturnType<typeof loadSanitizeSessionHistoryWithCleanMocks>>;
|
||||
let sanitizeSessionHistory: SanitizeSessionHistory;
|
||||
|
||||
vi.mock("./pi-embedded-helpers.js", async () => {
|
||||
const actual = await vi.importActual("./pi-embedded-helpers.js");
|
||||
return {
|
||||
...actual,
|
||||
isGoogleModelApi: vi.fn(),
|
||||
sanitizeSessionMessagesImages: vi.fn().mockImplementation(async (msgs) => msgs),
|
||||
};
|
||||
});
|
||||
|
||||
describe("sanitizeSessionHistory e2e smoke", () => {
|
||||
const mockSessionManager = makeMockSessionManager();
|
||||
const mockMessages = makeSimpleUserMessages();
|
||||
@@ -57,13 +54,8 @@ describe("sanitizeSessionHistory e2e smoke", () => {
|
||||
});
|
||||
|
||||
it("downgrades openai reasoning blocks when the model snapshot changed", async () => {
|
||||
const { sessionManager, messages, modelId } = makeSnapshotChangedOpenAIReasoningScenario();
|
||||
|
||||
const result = await sanitizeWithOpenAIResponses({
|
||||
const result = await sanitizeSnapshotChangedOpenAIReasoning({
|
||||
sanitizeSessionHistory,
|
||||
messages,
|
||||
modelId,
|
||||
sessionManager,
|
||||
});
|
||||
|
||||
expect(result).toEqual([]);
|
||||
|
||||
Reference in New Issue
Block a user