@@ -44,13 +44,10 @@ function fakeSim(protocolVersion = 1) {
4444 * `'offline'` for a request that never reached Sim.
4545 */
4646 const registrations : Array < ( answer : boolean | number | 'offline' ) => void > = [ ]
47- /** The JSON body of each registration request, in order. */
48- const registrationBodies : unknown [ ] = [ ]
4947 const fetch = vi . fn ( async ( url : string , init : RequestInit ) : Promise < Response > => {
5048 const path = new URL ( url ) . pathname
5149 requests . push ( `${ init . method } ${ path } ` )
5250 if ( path === '/api/desktop/devices' ) {
53- registrationBodies . push ( JSON . parse ( String ( init . body ) ) )
5451 const answer = await new Promise < boolean | number | 'offline' > ( ( resolve ) =>
5552 registrations . push ( resolve )
5653 )
@@ -96,14 +93,10 @@ function fakeSim(protocolVersion = 1) {
9693 init . signal ?. addEventListener ( 'abort' , ( ) => reject ( new Error ( 'aborted' ) ) )
9794 )
9895 } )
99- return { fetch, requests, registrations, registrationBodies , offered }
96+ return { fetch, requests, registrations, offered }
10097}
10198
102- async function service (
103- protocolVersion = 1 ,
104- userDataPath ?: string ,
105- platform : NodeJS . Platform = 'darwin'
106- ) {
99+ async function service ( protocolVersion = 1 , userDataPath ?: string ) {
107100 const sim = fakeSim ( protocolVersion )
108101 /** What the sleep blocker was told, in order. */
109102 const busy : boolean [ ] = [ ]
@@ -124,7 +117,6 @@ async function service(
124117 cancel : async ( ) => { } ,
125118 } ,
126119 onBusyChange : ( value ) => busy . push ( value ) ,
127- platform,
128120 } )
129121 return { sim, desktopExecutor, busy }
130122}
@@ -227,21 +219,6 @@ describe('results recovery will hand to the model', () => {
227219} )
228220
229221describe ( 'desktop executor registration' , ( ) => {
230- it . each ( [ 'darwin' , 'win32' ] as const ) (
231- 'advertises the terminal and native file tools on %s' ,
232- async ( platform ) => {
233- const { sim, desktopExecutor } = await service ( 1 , undefined , platform )
234- desktopExecutor . start ( )
235- await vi . waitFor ( ( ) => expect ( sim . registrations ) . toHaveLength ( 1 ) )
236-
237- expect ( sim . registrationBodies [ 0 ] ) . toMatchObject ( {
238- capabilities : { browser : true , terminal : true , localFiles : true } ,
239- } )
240- sim . registrations [ 0 ] ?.( false )
241- await desktopExecutor . signOut ( )
242- }
243- )
244-
245222 it ( 'offers the device for binding once Sim enables it' , async ( ) => {
246223 const { sim, desktopExecutor } = await service ( )
247224 desktopExecutor . start ( )
@@ -334,25 +311,20 @@ describe('desktop executor registration', () => {
334311 }
335312 } )
336313
337- it . skipIf ( process . platform === 'win32' ) (
338- 'registers with no install id it could not save' ,
339- async ( ) => {
340- const userData = await mkdtemp ( join ( tmpdir ( ) , 'sim-executor-service-' ) )
341- await chmod ( userData , 0o500 )
342- try {
343- const { sim, desktopExecutor } = await service ( 1 , userData )
344-
345- desktopExecutor . start ( )
346- await sleep ( 200 )
347-
348- expect ( sim . requests . filter ( ( request ) => request . includes ( '/api/desktop/devices' ) ) ) . toEqual (
349- [ ]
350- )
351- } finally {
352- await chmod ( userData , 0o700 )
353- }
314+ it ( 'registers with no install id it could not save' , async ( ) => {
315+ const userData = await mkdtemp ( join ( tmpdir ( ) , 'sim-executor-service-' ) )
316+ await chmod ( userData , 0o500 )
317+ try {
318+ const { sim, desktopExecutor } = await service ( 1 , userData )
319+
320+ desktopExecutor . start ( )
321+ await sleep ( 200 )
322+
323+ expect ( sim . requests . filter ( ( request ) => request . includes ( '/api/desktop/devices' ) ) ) . toEqual ( [ ] )
324+ } finally {
325+ await chmod ( userData , 0o700 )
354326 }
355- )
327+ } )
356328
357329 it ( 'keeps its install id through a read failure instead of minting a new one' , async ( ) => {
358330 const userData = await mkdtemp ( join ( tmpdir ( ) , 'sim-executor-service-' ) )
0 commit comments