File tree Expand file tree Collapse file tree
packages/js-sdk/tests/sandbox Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { assert , test } from 'vitest'
22
3- import { Sandbox } from '../../src'
4- import { isDebug , template } from '../setup.js'
3+ import sandbox , { Sandbox } from '../../src'
4+ import { isDebug , sandboxTest , template } from '../setup.js'
55
66test ( 'connect' , async ( ) => {
77 const sbx = await Sandbox . create ( template , { timeoutMs : 10_000 } )
@@ -19,12 +19,13 @@ test('connect', async () => {
1919 }
2020 }
2121} )
22+
2223sandboxTest ( 'connect to non-running sandbox' , async ( { sandbox } ) => {
23- const isRunning = await sbx . isRunning ( )
24+ const isRunning = await sandbox . isRunning ( )
2425 assert . isTrue ( isRunning )
25- await sbx . kill ( )
26+ await sandbox . kill ( )
2627
27- const sbxConnection = await Sandbox . connect ( sbx . sandboxId )
28+ const sbxConnection = await Sandbox . connect ( sandbox . sandboxId )
2829 const isRunning2 = await sbxConnection . isRunning ( )
2930 assert . isFalse ( isRunning2 )
3031} )
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ sandboxTest.skipIf(isDebug)(
4040 'ping server in non-running sandbox' ,
4141 async ( { sandbox } ) => {
4242 const host = sandbox . getHost ( 3000 )
43- const url = `https://{host}`
43+ const url = `https://$ {host } `
4444
4545 await sandbox . kill ( )
4646
@@ -52,8 +52,8 @@ sandboxTest.skipIf(isDebug)(
5252 const res2 = await fetch ( url )
5353 assert . equal ( res2 . status , 502 )
5454
55- const text = await res2 . text ( )
56- const json = JSON . parse ( text ) as {
55+ const text2 = await res2 . text ( )
56+ const json = JSON . parse ( text2 ) as {
5757 message : string
5858 sandboxId : string
5959 code : number
You can’t perform that action at this time.
0 commit comments