33 AuthOrchestrationReadScope ,
44 AuthOrchestrationOperateScope ,
55 AuthSessionId ,
6- DeviceOperationError ,
76 LOCAL_DEVICE_HOST_ID ,
87 type AuthEnvironmentScope ,
98} from "@t3tools/contracts" ;
@@ -25,8 +24,6 @@ const fixture = (
2524 fail = false ,
2625 authError ?: EnvironmentAuth . ServerAuthCredentialError | EnvironmentAuth . ServerAuthInternalError ,
2726 upstream ?: DeviceHost . DeviceHostReady [ "upstream" ] ,
28- screenshot : DeviceService . DeviceService [ "Service" ] [ "screenshot" ] = ( ) =>
29- Effect . die ( new Error ( "unexpected screenshot" ) ) ,
3027) => {
3128 let finalized = 0 ;
3229 const requests : string [ ] = [ ] ;
@@ -68,7 +65,6 @@ const fixture = (
6865 hub : { origin : "http://hub.test" } ,
6966 ...( upstream ? { upstream } : { } ) ,
7067 } ) ,
71- screenshot,
7268 } as DeviceService . DeviceService [ "Service" ] ) ,
7369 ) ,
7470 Layer . provideMerge ( Layer . succeed ( HttpClient . HttpClient , client ) ) ,
@@ -206,7 +202,7 @@ describe("device hub proxy", () => {
206202 undefined ,
207203 ( hubPath , search ) =>
208204 Effect . succeed (
209- hubPath === "/vendor/serve-sim/api" || hubPath === "/vendor/serve-sim/api/screenshot"
205+ hubPath === "/vendor/serve-sim/api"
210206 ? {
211207 url : `https://session.test${ hubPath . slice ( "/vendor/serve-sim" . length ) } ?${ search } ` ,
212208 headers : { authorization : "Bearer session-token" } ,
@@ -225,42 +221,11 @@ describe("device hub proxy", () => {
225221 await routed . text ( ) ;
226222 expect ( requests ) . toEqual ( [ "https://session.test/api?device=udid-1" ] ) ;
227223 expect ( headers [ 0 ] ?. authorization ) . toBe ( "Bearer session-token" ) ;
228- const screenshot = await handler (
229- new Request (
230- "http://t3.test/api/device-hub/vendor/serve-sim/api/screenshot?device=udid-1&hostId=eas" ,
231- { method : "POST" } ,
232- ) ,
233- ) ;
234- expect ( screenshot . status ) . toBe ( 200 ) ;
235- await screenshot . text ( ) ;
236- expect ( requests ) . toEqual ( [
237- "https://session.test/api?device=udid-1" ,
238- "https://session.test/api/screenshot?device=udid-1" ,
239- ] ) ;
240224 const unrouted = await handler (
241225 new Request ( "http://t3.test/api/device-hub/vendor/serve-sim/helper/udid-2/stream.mjpeg" ) ,
242226 ) ;
243227 expect ( unrouted . status ) . toBe ( 404 ) ;
244- expect ( requests ) . toHaveLength ( 2 ) ;
245- } ) ;
246-
247- it ( "keeps simctl diagnostics out of a failed iOS screenshot response" , async ( ) => {
248- const { handler } = fixture ( [ AuthOrchestrationReadScope ] , false , undefined , undefined , ( ) =>
249- Effect . fail (
250- new DeviceOperationError ( {
251- operation : "screenshot" ,
252- reason : "command_failed" ,
253- cause : "simctl failed" ,
254- } ) ,
255- ) ,
256- ) ;
257- const failed = await handler (
258- new Request ( "http://t3.test/api/device-hub/vendor/serve-sim/api/screenshot?device=udid-2" , {
259- method : "POST" ,
260- } ) ,
261- ) ;
262- expect ( failed . status ) . toBe ( 502 ) ;
263- expect ( await failed . text ( ) ) . not . toContain ( "simctl failed" ) ;
228+ expect ( requests ) . toHaveLength ( 1 ) ;
264229 } ) ;
265230
266231 it ( "never forwards the vendor shell endpoint" , async ( ) => {
0 commit comments