mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 15:21:35 +00:00
test: tighten web and cron cli timeout budgets
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import { Command } from "commander";
|
import { Command } from "commander";
|
||||||
import { describe, expect, it, vi } from "vitest";
|
import { describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
|
const CRON_CLI_TEST_TIMEOUT_MS = 15_000;
|
||||||
|
|
||||||
const defaultGatewayMock = async (
|
const defaultGatewayMock = async (
|
||||||
method: string,
|
method: string,
|
||||||
_opts: unknown,
|
_opts: unknown,
|
||||||
@@ -143,7 +145,7 @@ async function expectCronEditWithScheduleLookupExit(
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe("cron cli", () => {
|
describe("cron cli", () => {
|
||||||
it("trims model and thinking on cron add", { timeout: 60_000 }, async () => {
|
it("trims model and thinking on cron add", { timeout: CRON_CLI_TEST_TIMEOUT_MS }, async () => {
|
||||||
await runCronCommand([
|
await runCronCommand([
|
||||||
"cron",
|
"cron",
|
||||||
"add",
|
"add",
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ const runtime = {
|
|||||||
error: vi.fn(),
|
error: vi.fn(),
|
||||||
exit: vi.fn(),
|
exit: vi.fn(),
|
||||||
};
|
};
|
||||||
|
const WEB_LOGOUT_TEST_TIMEOUT_MS = 15_000;
|
||||||
|
|
||||||
describe("web logout", () => {
|
describe("web logout", () => {
|
||||||
let fixtureRoot = "";
|
let fixtureRoot = "";
|
||||||
@@ -48,12 +49,16 @@ describe("web logout", () => {
|
|||||||
vi.restoreAllMocks();
|
vi.restoreAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("deletes cached credentials when present", { timeout: 60_000 }, async () => {
|
it(
|
||||||
const authDir = await createAuthCase({ "creds.json": "{}" });
|
"deletes cached credentials when present",
|
||||||
const result = await logoutWeb({ authDir, runtime: runtime as never });
|
{ timeout: WEB_LOGOUT_TEST_TIMEOUT_MS },
|
||||||
expect(result).toBe(true);
|
async () => {
|
||||||
expect(fs.existsSync(authDir)).toBe(false);
|
const authDir = await createAuthCase({ "creds.json": "{}" });
|
||||||
});
|
const result = await logoutWeb({ authDir, runtime: runtime as never });
|
||||||
|
expect(result).toBe(true);
|
||||||
|
expect(fs.existsSync(authDir)).toBe(false);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
it("removes oauth.json too when not using legacy auth dir", async () => {
|
it("removes oauth.json too when not using legacy auth dir", async () => {
|
||||||
const authDir = await createAuthCase({
|
const authDir = await createAuthCase({
|
||||||
@@ -66,7 +71,7 @@ describe("web logout", () => {
|
|||||||
expect(fs.existsSync(authDir)).toBe(false);
|
expect(fs.existsSync(authDir)).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("no-ops when nothing to delete", { timeout: 60_000 }, async () => {
|
it("no-ops when nothing to delete", { timeout: WEB_LOGOUT_TEST_TIMEOUT_MS }, async () => {
|
||||||
const authDir = await makeCaseDir();
|
const authDir = await makeCaseDir();
|
||||||
const result = await logoutWeb({ authDir, runtime: runtime as never });
|
const result = await logoutWeb({ authDir, runtime: runtime as never });
|
||||||
expect(result).toBe(false);
|
expect(result).toBe(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user