mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 15:41:36 +00:00
test(core): use lightweight clears in subagent and browser setup
This commit is contained in:
@@ -60,8 +60,8 @@ const baseCfg = {
|
|||||||
describe("/subagents spawn command", () => {
|
describe("/subagents spawn command", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
resetSubagentRegistryForTests();
|
resetSubagentRegistryForTests();
|
||||||
spawnSubagentDirectMock.mockReset();
|
spawnSubagentDirectMock.mockClear();
|
||||||
hoisted.callGatewayMock.mockReset();
|
hoisted.callGatewayMock.mockClear();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("shows usage when agentId is missing", async () => {
|
it("shows usage when agentId is missing", async () => {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ const getChromeWebSocketUrlSpy = vi.spyOn(chromeModule, "getChromeWebSocketUrl")
|
|||||||
|
|
||||||
describe("pw-session getPageForTargetId", () => {
|
describe("pw-session getPageForTargetId", () => {
|
||||||
it("falls back to the only page when CDP session attachment is blocked (extension relays)", async () => {
|
it("falls back to the only page when CDP session attachment is blocked (extension relays)", async () => {
|
||||||
connectOverCdpSpy.mockReset();
|
connectOverCdpSpy.mockClear();
|
||||||
getChromeWebSocketUrlSpy.mockReset();
|
getChromeWebSocketUrlSpy.mockClear();
|
||||||
|
|
||||||
const pageOn = vi.fn();
|
const pageOn = vi.fn();
|
||||||
const contextOn = vi.fn();
|
const contextOn = vi.fn();
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ async function createMessageHandlerAndReplySpy() {
|
|||||||
const replyModule = await import("../auto-reply/reply.js");
|
const replyModule = await import("../auto-reply/reply.js");
|
||||||
const replySpy = (replyModule as unknown as { __replySpy: ReturnType<typeof vi.fn> }).__replySpy;
|
const replySpy = (replyModule as unknown as { __replySpy: ReturnType<typeof vi.fn> }).__replySpy;
|
||||||
|
|
||||||
onSpy.mockReset();
|
onSpy.mockClear();
|
||||||
replySpy.mockReset();
|
replySpy.mockClear();
|
||||||
|
|
||||||
createTelegramBot({ token: "tok" });
|
createTelegramBot({ token: "tok" });
|
||||||
const handler = onSpy.mock.calls.find((call) => call[0] === "message")?.[1] as (
|
const handler = onSpy.mock.calls.find((call) => call[0] === "message")?.[1] as (
|
||||||
|
|||||||
Reference in New Issue
Block a user