@@ -3,13 +3,13 @@ import { expect } from 'vitest'
33import { sandboxTest } from '../setup'
44
55sandboxTest ( 'js simple' , async ( { sandbox } ) => {
6- const result = await sandbox . runCode ( 'console.log("Hello, World!")' , { language : "js " } )
6+ const result = await sandbox . runCode ( 'console.log("Hello, World!")' , { language : "deno " } )
77
88 expect ( result . logs . stdout . join ( ) . trim ( ) ) . toEqual ( 'Hello, World!' )
99} )
1010
1111sandboxTest ( 'js import' , async ( { sandbox } ) => {
12- const result = await sandbox . runCode ( 'import isOdd from "npm:is-odd"\nisOdd(3)' , { language : "js " } )
12+ const result = await sandbox . runCode ( 'import isOdd from "npm:is-odd"\nisOdd(3)' , { language : "deno " } )
1313
1414 expect ( result . results [ 0 ] . text ) . toEqual ( 'true' )
1515} )
@@ -21,30 +21,29 @@ sandboxTest('js top level await', async ({ sandbox }) => {
2121 }
2222
2323 await main()
24- ` , { language : "js " } )
24+ ` , { language : "deno " } )
2525 expect ( result . results [ 0 ] . text ) . toEqual ( 'Hello, World!' )
2626} )
2727
2828sandboxTest ( 'js es6' , async ( { sandbox } ) => {
2929 const result = await sandbox . runCode ( `
30- const add = (x, y) => x + y;
31- add(1, 2)
32- ` , { language : "js" } )
30+ const add = (x, y) => x + y;
31+ add(1, 2)` , { language : "deno" } )
3332 expect ( result . results [ 0 ] . text ) . toEqual ( '3' )
3433} )
3534
3635
3736sandboxTest ( 'js context' , async ( { sandbox } ) => {
38- await sandbox . runCode ( 'const z = 1' , { language : "js " } )
39- const result = await sandbox . runCode ( 'z' , { language : "js " } )
37+ await sandbox . runCode ( 'const z = 1' , { language : "deno " } )
38+ const result = await sandbox . runCode ( 'z' , { language : "deno " } )
4039 expect ( result . results [ 0 ] . text ) . toEqual ( '1' )
4140} )
4241
4342sandboxTest ( 'js cwd' , async ( { sandbox } ) => {
44- const result = await sandbox . runCode ( 'process.cwd()' , { language : "js" } )
43+ const result = await sandbox . runCode ( 'process.cwd()' , { language : "deno })
4544 expect ( result . results [ 0 ] . text ) . toEqual ( '/home/user' )
4645
47- const ctx = await sandbox . createCodeContext ( { cwd : '/home' , language : "js " } )
46+ const ctx = await sandbox . createCodeContext ( { cwd : '/home' , language : "deno " } )
4847 const result2 = await sandbox . runCode ( 'process.cwd()' , { context : ctx } )
4948 expect ( result2 . results [ 0 ] . text ) . toEqual ( '/home' )
5049} )
@@ -56,7 +55,7 @@ function subtract(x: number, y: number): number {
5655}
5756
5857subtract(1, 2)
59- ` , { language : "ts " } )
58+ ` , { language : "deno " } )
6059
6160 expect ( result . results [ 0 ] . text ) . toEqual ( '-1' )
6261} )
0 commit comments