mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-25 08:02:04 +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", () => {
|
||||
beforeEach(() => {
|
||||
vi.stubEnv("OPENCLAW_TEST_FAST", "1");
|
||||
agentMocks.runEmbeddedPiAgent.mockReset();
|
||||
agentMocks.loadModelCatalog.mockReset();
|
||||
agentMocks.runEmbeddedPiAgent.mockClear();
|
||||
agentMocks.loadModelCatalog.mockClear();
|
||||
agentMocks.loadModelCatalog.mockResolvedValue([
|
||||
{ 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", () => {
|
||||
beforeEach(() => {
|
||||
runCommandWithTimeoutMock.mockReset();
|
||||
runCommandWithTimeoutMock.mockClear();
|
||||
});
|
||||
|
||||
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;
|
||||
|
||||
beforeEach(() => {
|
||||
cacheStickerSpy.mockReset();
|
||||
getCachedStickerSpy.mockReset();
|
||||
describeStickerImageSpy.mockReset();
|
||||
cacheStickerSpy.mockClear();
|
||||
getCachedStickerSpy.mockClear();
|
||||
describeStickerImageSpy.mockClear();
|
||||
// Re-seed defaults so per-test overrides do not leak when using mockClear.
|
||||
getCachedStickerSpy.mockReturnValue(undefined);
|
||||
describeStickerImageSpy.mockReturnValue(undefined);
|
||||
});
|
||||
|
||||
it(
|
||||
|
||||
@@ -121,7 +121,7 @@ describe("resolveTelegramAutoSelectFamilyDecision", () => {
|
||||
});
|
||||
|
||||
it("memoizes WSL2 detection across repeated defaults", () => {
|
||||
vi.mocked(isWSL2Sync).mockReset();
|
||||
vi.mocked(isWSL2Sync).mockClear();
|
||||
vi.mocked(isWSL2Sync).mockReturnValue(false);
|
||||
resolveTelegramAutoSelectFamilyDecision({ env: {}, nodeMajor: 22 });
|
||||
resolveTelegramAutoSelectFamilyDecision({ env: {}, nodeMajor: 22 });
|
||||
|
||||
@@ -19,7 +19,7 @@ import { selectStyled } from "./prompt-select-styled.js";
|
||||
|
||||
describe("selectStyled", () => {
|
||||
beforeEach(() => {
|
||||
selectMock.mockReset();
|
||||
selectMock.mockClear();
|
||||
stylePromptMessageMock.mockClear();
|
||||
stylePromptHintMock.mockClear();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user