mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-21 21:56:46 +00:00
test: bind pairing hint commands
This commit is contained in:
@@ -60,6 +60,10 @@ function createOverviewProps(overrides: Partial<OverviewProps> = {}): OverviewPr
|
||||
};
|
||||
}
|
||||
|
||||
function compactText(node: Element | null): string | undefined {
|
||||
return node?.textContent?.trim().replace(/\s+/g, " ");
|
||||
}
|
||||
|
||||
describe("overview view rendering", () => {
|
||||
it("keeps the persisted overview locale selected before i18n hydration finishes", async () => {
|
||||
const container = document.createElement("div");
|
||||
@@ -102,11 +106,14 @@ describe("overview view rendering", () => {
|
||||
render(renderOverview(props), container);
|
||||
await Promise.resolve();
|
||||
|
||||
expect(container.textContent).toContain("Scope upgrade pending approval.");
|
||||
expect(container.textContent).toContain(
|
||||
"This device is already paired, but the requested wider scope is waiting for approval.",
|
||||
const hint = container.querySelector(".mono")?.closest(".muted") ?? null;
|
||||
expect(compactText(hint)).toBe(
|
||||
"Scope upgrade pending approval. This device is already paired, but the requested wider scope is waiting for approval. openclaw devices approve req-123 openclaw devices list On mobile? Copy the full URL (including #token=...) from openclaw dashboard --no-open on your desktop. Docs: Device pairing",
|
||||
);
|
||||
expect(container.textContent).toContain("openclaw devices approve req-123");
|
||||
expect([...container.querySelectorAll(".mono")].map((node) => node.textContent)).toEqual([
|
||||
"openclaw devices approve req-123",
|
||||
"openclaw devices list",
|
||||
]);
|
||||
});
|
||||
|
||||
it("does not suggest preview-only latest approval when the request id is absent", async () => {
|
||||
@@ -119,8 +126,12 @@ describe("overview view rendering", () => {
|
||||
render(renderOverview(props), container);
|
||||
await Promise.resolve();
|
||||
|
||||
expect(container.textContent).toContain("Scope upgrade pending approval.");
|
||||
expect(container.textContent).toContain("openclaw devices list");
|
||||
expect(container.textContent).not.toContain("openclaw devices approve --latest");
|
||||
const hint = container.querySelector(".mono")?.closest(".muted") ?? null;
|
||||
expect(compactText(hint)).toBe(
|
||||
"Scope upgrade pending approval. This device is already paired, but the requested wider scope is waiting for approval. openclaw devices list On mobile? Copy the full URL (including #token=...) from openclaw dashboard --no-open on your desktop. Docs: Device pairing",
|
||||
);
|
||||
expect([...container.querySelectorAll(".mono")].map((node) => node.textContent)).toEqual([
|
||||
"openclaw devices list",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user