mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 22:58:26 +00:00
test(core): use lightweight clears in runtime and telegram setup
This commit is contained in:
@@ -36,8 +36,8 @@ const { withTempHome } = createTempHomeHarness({ prefix: "openclaw-rawbody-" });
|
|||||||
describe("RawBody directive parsing", () => {
|
describe("RawBody directive parsing", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.stubEnv("OPENCLAW_TEST_FAST", "1");
|
vi.stubEnv("OPENCLAW_TEST_FAST", "1");
|
||||||
agentMocks.runEmbeddedPiAgent.mockReset();
|
agentMocks.runEmbeddedPiAgent.mockClear();
|
||||||
agentMocks.loadModelCatalog.mockReset();
|
agentMocks.loadModelCatalog.mockClear();
|
||||||
agentMocks.loadModelCatalog.mockResolvedValue([
|
agentMocks.loadModelCatalog.mockResolvedValue([
|
||||||
{ id: "claude-opus-4-5", name: "Opus 4.5", provider: "anthropic" },
|
{ id: "claude-opus-4-5", name: "Opus 4.5", provider: "anthropic" },
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { createPluginRuntime } from "./index.js";
|
|||||||
|
|
||||||
describe("plugin runtime command execution", () => {
|
describe("plugin runtime command execution", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
runCommandWithTimeoutMock.mockReset();
|
runCommandWithTimeoutMock.mockClear();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("exposes runtime.system.runCommandWithTimeout by default", async () => {
|
it("exposes runtime.system.runCommandWithTimeout by default", async () => {
|
||||||
|
|||||||
@@ -326,9 +326,12 @@ describe("telegram stickers", () => {
|
|||||||
const STICKER_TEST_TIMEOUT_MS = process.platform === "win32" ? 30_000 : 20_000;
|
const STICKER_TEST_TIMEOUT_MS = process.platform === "win32" ? 30_000 : 20_000;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cacheStickerSpy.mockReset();
|
cacheStickerSpy.mockClear();
|
||||||
getCachedStickerSpy.mockReset();
|
getCachedStickerSpy.mockClear();
|
||||||
describeStickerImageSpy.mockReset();
|
describeStickerImageSpy.mockClear();
|
||||||
|
// Re-seed defaults so per-test overrides do not leak when using mockClear.
|
||||||
|
getCachedStickerSpy.mockReturnValue(undefined);
|
||||||
|
describeStickerImageSpy.mockReturnValue(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ describe("resolveTelegramAutoSelectFamilyDecision", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("memoizes WSL2 detection across repeated defaults", () => {
|
it("memoizes WSL2 detection across repeated defaults", () => {
|
||||||
vi.mocked(isWSL2Sync).mockReset();
|
vi.mocked(isWSL2Sync).mockClear();
|
||||||
vi.mocked(isWSL2Sync).mockReturnValue(false);
|
vi.mocked(isWSL2Sync).mockReturnValue(false);
|
||||||
resolveTelegramAutoSelectFamilyDecision({ env: {}, nodeMajor: 22 });
|
resolveTelegramAutoSelectFamilyDecision({ env: {}, nodeMajor: 22 });
|
||||||
resolveTelegramAutoSelectFamilyDecision({ env: {}, nodeMajor: 22 });
|
resolveTelegramAutoSelectFamilyDecision({ env: {}, nodeMajor: 22 });
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import { selectStyled } from "./prompt-select-styled.js";
|
|||||||
|
|
||||||
describe("selectStyled", () => {
|
describe("selectStyled", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
selectMock.mockReset();
|
selectMock.mockClear();
|
||||||
stylePromptMessageMock.mockClear();
|
stylePromptMessageMock.mockClear();
|
||||||
stylePromptHintMock.mockClear();
|
stylePromptHintMock.mockClear();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user