Skip to content

Commit 408d629

Browse files
author
Shaw
committed
fix(agent): align test typings with xr views
1 parent a0daa96 commit 408d629

2 files changed

Lines changed: 26 additions & 12 deletions

File tree

packages/agent/src/__tests__/plugin-tui-view-coverage.test.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import {
1616
type ViewsRouteContext,
1717
} from "../api/views-routes.js";
1818

19+
type CoveredViewType = "gui" | "tui";
20+
1921
const repoRoot = resolve(
2022
dirname(fileURLToPath(import.meta.url)),
2123
"../../../..",
@@ -342,7 +344,7 @@ describe("plugin TUI view coverage", () => {
342344
const views: Array<{
343345
manifestPath: string;
344346
id: string;
345-
viewType: "gui" | "tui";
347+
viewType: CoveredViewType;
346348
path?: string;
347349
}> = [];
348350

@@ -361,10 +363,12 @@ describe("plugin TUI view coverage", () => {
361363
undefined,
362364
);
363365
for (const declaration of declarations) {
366+
const viewType = declaration.viewType ?? "gui";
367+
if (viewType === "xr") continue;
364368
views.push({
365369
manifestPath,
366370
id: declaration.id,
367-
viewType: declaration.viewType ?? "gui",
371+
viewType,
368372
path: declaration.path,
369373
});
370374
}
@@ -410,7 +414,7 @@ describe("plugin TUI view coverage", () => {
410414
const views: Array<{
411415
manifestPath: string;
412416
id: string;
413-
viewType: "gui" | "tui";
417+
viewType: CoveredViewType;
414418
}> = [];
415419

416420
try {
@@ -428,10 +432,12 @@ describe("plugin TUI view coverage", () => {
428432
undefined,
429433
);
430434
for (const declaration of declarations) {
435+
const viewType = declaration.viewType ?? "gui";
436+
if (viewType === "xr") continue;
431437
views.push({
432438
manifestPath,
433439
id: declaration.id,
434-
viewType: declaration.viewType ?? "gui",
440+
viewType,
435441
});
436442
}
437443
}

packages/agent/src/services/remote-capability-cloud-sandbox.test.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,24 @@ describe("cloud capability sandbox provisioner", () => {
154154

155155
it("waits until a cloud capability endpoint reports plugin availability", async () => {
156156
const progress: string[] = [];
157-
const fetchMock = vi.fn(async () => {
158-
const attempt = fetchMock.mock.calls.length;
159-
if (attempt === 1) {
157+
const fetchMock = vi.fn(
158+
async (
159+
_input: string | URL | Request,
160+
_init?: RequestInit,
161+
): Promise<Response> => {
162+
const attempt = fetchMock.mock.calls.length;
163+
if (attempt === 1) {
164+
return jsonResponse({
165+
available: false,
166+
capabilities: { plugin: false },
167+
});
168+
}
160169
return jsonResponse({
161-
available: false,
162-
capabilities: { plugin: false },
170+
available: true,
171+
capabilities: { plugin: true },
163172
});
164-
}
165-
return jsonResponse({ available: true, capabilities: { plugin: true } });
166-
});
173+
},
174+
);
167175

168176
await expect(
169177
waitForCloudCapabilityEndpointAvailability({

0 commit comments

Comments
 (0)