Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): discover never-used iOS simulators #28915

Closedsreejithraman(GitHub profile, opens in a new tab)wants to merge 11 commits intomain fromrefs/pull/28915/headopened View on GitHub

Showing 9 changed files with 160 additions and 8 deletions (loading 6).

x
0 of 9 viewed, 9 left
107 additions and 0 deletionsapps/server/src/device/DeviceHubOperations.test.tsAdded
View file
@@ -0,0 +1,107 @@
+import { expect, it } from "@effect/vitest";
+import { LOCAL_DEVICE_HOST_ID } from "@t3tools/contracts";
+import * as Effect from "effect/Effect";
+import { HttpClient, HttpClientResponse } from "effect/http";
+​
+import { makeDeviceHubOperations } from "./DeviceHubOperations.ts";
+​
+const used = {
+ id: "used",
+ name: "Used iPhone",
+ version: "iOS 27.0",
+ platform: "ios",
+ booted: true,
+ physical: false,
+} as const;
+​
+it.effect("adds never-used iOS simulators from the hub's grid", () =>
+ Effect.gen(function* () {
+ const operations = makeDeviceHubOperations({
+ hostId: LOCAL_DEVICE_HOST_ID,
+ origin: "http://device.test",
+ http: HttpClient.make((request) =>
+ Effect.succeed(
+ HttpClientResponse.fromWeb(
+ request,
+ Response.json(
+ request.url.endsWith("/api/devices")
+ ? // The hub's recent-device inventory omits simulators without usage timestamps.
+ { simulators: [used], emulators: [] }
+ : {