Skip to content

Commit 1581fb9

Browse files
shivamhwpclaude
andcommitted
test(devices): drop redundant discovery cases
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent ea35c35 commit 1581fb9

3 files changed

Lines changed: 8 additions & 88 deletions

File tree

‎apps/server/src/device/DeviceService.test.ts‎

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,7 @@ const fixture = Effect.fn("fixture")(function* (
164164
Response.json(
165165
bootError
166166
? { ok: false, ...(typeof bootError === "string" ? { error: bootError } : bootError) }
167-
: // The hub reports a serial only for emulators; a simulator keeps its UDID.
168-
request.body._tag === "Uint8Array" &&
169-
new TextDecoder().decode(request.body.body).includes('"platform":"ios"')
170-
? { ok: true }
171-
: { ok: true, serial: "emulator-5554" },
167+
: { ok: true, serial: "emulator-5554" },
172168
),
173169
);
174170
}
@@ -260,16 +256,14 @@ const fixture = Effect.fn("fixture")(function* (
260256
if (runtimeFailure && runtimeFailure._tag !== "AgentDeviceStartError")
261257
return yield* runtimeFailure;
262258
starts.push("start");
263-
// A running hub reports no phase, as the real hosts do.
264-
if (starts.length === 1)
265-
yield* onPhase("installing", "Updating device hub from 0.9.0 to 0.10.1…");
259+
yield* onPhase("installing", "Updating device hub from 0.9.0 to 0.10.1…");
266260
return ready;
267261
}),
268262
ensureAgentReady: (onPhase) =>
269263
Effect.gen(function* () {
270264
if (runtimeFailure) return yield* runtimeFailure;
271265
agentStarts.push("start");
272-
if (agentStarts.length === 1) yield* onPhase("starting");
266+
yield* onPhase("starting");
273267
return {
274268
...ready,
275269
agentDevice: { baseUrl: "http://agent.test", token: "test", entryPath: "/agent" },
@@ -361,19 +355,12 @@ describe("device setup consent", () => {
361355
reason: "daemon_lock_not_directory",
362356
cause: { stdout: "private startup diagnostics", code: 1 },
363357
});
364-
const { service, settings, discoveryErrors } = yield* fixture(
365-
Effect.void,
366-
undefined,
367-
false,
368-
startupError,
369-
);
358+
const { service, settings } = yield* fixture(Effect.void, undefined, false, startupError);
370359
yield* Ref.update(settings, (current) => ({
371360
...current,
372361
enableDeviceSupport: true,
373362
enableAgentDeviceAccess: true,
374363
}));
375-
yield* Ref.set(discoveryErrors, [{ message: simctlMessage }]);
376-
yield* service.list;
377364
const error = yield* service.agentReadinessIfSupported().pipe(Effect.flip);
378365
expect(error).toMatchObject({
379366
_tag: "DeviceHostUnavailableError",
@@ -385,7 +372,6 @@ describe("device setup consent", () => {
385372
expect((yield* service.state).hostStatuses[LOCAL_DEVICE_HOST_ID]).toEqual({
386373
status: "failed",
387374
detail: startupError.message,
388-
incompletePlatforms: ["ios"],
389375
});
390376
}).pipe(Effect.scoped),
391377
);
@@ -881,14 +867,6 @@ it.effect(
881867
});
882868
yield* service.agentReadinessIfSupported();
883869
expect((yield* service.state).hostStatuses.local).toEqual(failed.hostStatuses.local);
884-
yield* service.setHostStatus(LOCAL_DEVICE_HOST_ID, {
885-
status: "starting",
886-
detail: "Reconnecting to device host…",
887-
});
888-
yield* service.setHostStatus(LOCAL_DEVICE_HOST_ID, { status: "ready" });
889-
const reconnected = yield* service.state;
890-
expect(reconnected.hostStatuses.local).toEqual(failed.hostStatuses.local);
891-
expect(reconnected.hostStatusDetail).toBe(simctlMessage);
892870
yield* Ref.set(discoveryErrors, []);
893871
const recovered = yield* service.list;
894872
expect(recovered.devices.map((device) => device.id)).toEqual(["Pixel_API_35"]);
@@ -954,25 +932,6 @@ it.effect("does not open a retained pre-boot entry when the post-boot listing is
954932
yield* TestClock.adjust("40 seconds");
955933
expect((yield* Fiber.join(opening))._tag).toBe("DeviceNotFoundError");
956934
expect((yield* android.service.state).sessions).toEqual([]);
957-
958-
const ios = yield* fixture(Effect.suspend(() => afterBoot.run));
959-
afterBoot.run = Effect.sync(() => {
960-
ios.devices.length = 0;
961-
}).pipe(Effect.andThen(Ref.set(ios.discoveryErrors, [{ message: simctlMessage }])));
962-
ios.devices.push({
963-
id: DeviceId.make("iphone"),
964-
name: "iPhone",
965-
platform: "ios",
966-
version: "iOS 26",
967-
booted: false,
968-
physical: false,
969-
});
970-
yield* ios.service.configure({ enabled: true });
971-
const error = yield* ios.service
972-
.open({ threadId: ThreadId.make("boot-simctl"), deviceId: "iphone", platform: "ios" })
973-
.pipe(Effect.flip);
974-
expect(error._tag).toBe("DeviceNotFoundError");
975-
expect((yield* ios.service.state).sessions).toEqual([]);
976935
}).pipe(Effect.scoped),
977936
);
978937

‎apps/web/src/components/device/DevicePanel.browser.test.tsx‎

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
} from "@t3tools/contracts";
77
import type { ReactNode } from "react";
88
import { describe, expect, it, vi } from "vite-plus/test";
9-
import { page } from "vite-plus/test/browser";
109

1110
import type { RightPanelSurface } from "~/rightPanelStore";
1211

@@ -216,42 +215,22 @@ describe("DevicePanel host probe", () => {
216215
});
217216

218217
describe("DevicePanel discovery warning", () => {
219-
it("keeps Details open across causes and a dismissal only for the cause it hid", async () => {
218+
it("a dismissal hides only the cause it was made for", async () => {
220219
setup();
221-
const withCause = (
222-
detail: string,
223-
incompletePlatforms: ReadonlyArray<"ios" | "android"> = ["ios"],
224-
): DeviceServiceState => ({
220+
const withCause = (detail: string): DeviceServiceState => ({
225221
...deviceState,
226-
hostStatuses: { local: { status: "ready", detail, incompletePlatforms } },
222+
hostStatuses: { local: { status: "ready", detail, incompletePlatforms: ["ios"] } },
227223
});
228224
const warning = "iOS list on This Mac may be incomplete.";
229225
currentState = withCause("first cause");
230226
await using screen = await render(devicePanel(threadA), { container });
231227

232-
await screen.getByRole("button", { name: "Details for This Mac" }).click();
233-
await expect.element(page.getByText("first cause")).toBeVisible();
234-
235-
currentState = withCause("second cause");
236-
await screen.rerender(devicePanel(threadA));
237-
await expect.element(page.getByText("second cause")).toBeVisible();
238-
239228
await screen.getByRole("button", { name: "Dismiss device warning for This Mac" }).click();
240229
await screen.rerender(devicePanel(threadA));
241230
await expect.element(screen.getByText(warning)).not.toBeInTheDocument();
242231

243-
currentState = withCause("second cause", ["ios", "android"]);
244-
await screen.rerender(devicePanel(threadA));
245-
await expect
246-
.element(screen.getByText("iOS and Android lists on This Mac may be incomplete."))
247-
.toBeVisible();
248-
249232
currentState = withCause("second cause");
250233
await screen.rerender(devicePanel(threadA));
251234
await expect.element(screen.getByText(warning)).toBeVisible();
252-
253-
currentState = withCause("third cause");
254-
await screen.rerender(devicePanel(threadA));
255-
await expect.element(screen.getByText(warning)).toBeVisible();
256235
});
257236
});

‎apps/web/src/components/device/DeviceSetup.test.ts‎

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import type { DeviceServiceState } from "@t3tools/contracts";
22
import { describe, expect, it } from "vite-plus/test";
33

4-
import {
5-
deviceHubReadiness,
6-
incompleteListings,
7-
isAndroidDiscoveryUncertain,
8-
platformSetupStatus,
9-
} from "./DeviceSetup";
4+
import { deviceHubReadiness, platformSetupStatus } from "./DeviceSetup";
105

116
const deviceState = (overrides: Partial<DeviceServiceState> = {}): DeviceServiceState => ({
127
hosts: [
@@ -52,19 +47,6 @@ describe("device setup guidance", () => {
5247
"ios",
5348
).message,
5449
).toContain("discovery reported a problem");
55-
expect(
56-
isAndroidDiscoveryUncertain({
57-
...state,
58-
hostStatuses: { remote: { status: "ready", incompletePlatforms: ["ios", "android"] } },
59-
}),
60-
).toBe(true);
61-
expect(
62-
incompleteListings({
63-
status: "ready",
64-
androidDiscoveryIncomplete: true,
65-
incompletePlatforms: ["ios"],
66-
}),
67-
).toEqual(["ios", "android"]);
6850
});
6951

7052
it("counts a remote device host when this machine has no simulator tooling", () => {

0 commit comments

Comments
 (0)