mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 00:00:23 +00:00
chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import {
|
||||
browserOpenTab,
|
||||
browserSnapshot,
|
||||
browserStatus,
|
||||
browserTabs,
|
||||
} from "./client.js";
|
||||
import { browserOpenTab, browserSnapshot, browserStatus, browserTabs } from "./client.js";
|
||||
import {
|
||||
browserAct,
|
||||
browserArmDialog,
|
||||
@@ -31,16 +26,12 @@ describe("browser client", () => {
|
||||
|
||||
vi.stubGlobal("fetch", vi.fn().mockRejectedValue(fetchFailed));
|
||||
|
||||
await expect(browserStatus("http://127.0.0.1:18791")).rejects.toThrow(
|
||||
/Start .*gateway/i,
|
||||
);
|
||||
await expect(browserStatus("http://127.0.0.1:18791")).rejects.toThrow(/Start .*gateway/i);
|
||||
});
|
||||
|
||||
it("adds useful timeout messaging for abort-like failures", async () => {
|
||||
vi.stubGlobal("fetch", vi.fn().mockRejectedValue(new Error("aborted")));
|
||||
await expect(browserStatus("http://127.0.0.1:18791")).rejects.toThrow(
|
||||
/timed out/i,
|
||||
);
|
||||
await expect(browserStatus("http://127.0.0.1:18791")).rejects.toThrow(/timed out/i);
|
||||
});
|
||||
|
||||
it("surfaces non-2xx responses with body text", async () => {
|
||||
@@ -182,16 +173,12 @@ describe("browser client", () => {
|
||||
}),
|
||||
);
|
||||
|
||||
await expect(
|
||||
browserStatus("http://127.0.0.1:18791"),
|
||||
).resolves.toMatchObject({
|
||||
await expect(browserStatus("http://127.0.0.1:18791")).resolves.toMatchObject({
|
||||
running: true,
|
||||
cdpPort: 18792,
|
||||
});
|
||||
|
||||
await expect(browserTabs("http://127.0.0.1:18791")).resolves.toHaveLength(
|
||||
1,
|
||||
);
|
||||
await expect(browserTabs("http://127.0.0.1:18791")).resolves.toHaveLength(1);
|
||||
await expect(
|
||||
browserOpenTab("http://127.0.0.1:18791", "https://example.com"),
|
||||
).resolves.toMatchObject({ targetId: "t2" });
|
||||
@@ -217,9 +204,10 @@ describe("browser client", () => {
|
||||
await expect(
|
||||
browserConsoleMessages("http://127.0.0.1:18791", { level: "error" }),
|
||||
).resolves.toMatchObject({ ok: true, targetId: "t1" });
|
||||
await expect(
|
||||
browserPdfSave("http://127.0.0.1:18791"),
|
||||
).resolves.toMatchObject({ ok: true, path: "/tmp/a.pdf" });
|
||||
await expect(browserPdfSave("http://127.0.0.1:18791")).resolves.toMatchObject({
|
||||
ok: true,
|
||||
path: "/tmp/a.pdf",
|
||||
});
|
||||
await expect(
|
||||
browserScreenshotAction("http://127.0.0.1:18791", { fullPage: true }),
|
||||
).resolves.toMatchObject({ ok: true, path: "/tmp/a.png" });
|
||||
|
||||
Reference in New Issue
Block a user