Skip to content

Commit e80eb18

Browse files
authored
added ts-kernel tests (#99)
1 parent 8251c2f commit e80eb18

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

js/tests/defaultKernels.test.ts

+15
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,18 @@ sandboxTest('test js kernel', async ({ sandbox }) => {
88
})
99
expect(output.logs.stdout).toEqual(['Hello World!\n'])
1010
})
11+
12+
sandboxTest('test ts kernel', async ({ sandbox }) => {
13+
const output = await sandbox.runCode(
14+
'const message: string = "Hello World!"; console.log(message)',
15+
{ language: 'ts' }
16+
)
17+
expect(output.logs.stdout).toEqual(['Hello World!\n'])
18+
})
19+
20+
sandboxTest('test ts kernel errors', async ({ sandbox }) => {
21+
const output = await sandbox.runCode('import x from "module";', {
22+
language: 'typescript',
23+
})
24+
expect(output.error?.name).toEqual('TypeScriptCompilerError')
25+
})

python/tests/async/test_async_default_kernels.py

+15
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,18 @@ async def test_js_kernel(async_sandbox: AsyncSandbox):
66
"console.log('Hello, World!')", language="js"
77
)
88
assert execution.logs.stdout == ["Hello, World!\n"]
9+
10+
11+
async def test_ts_kernel(async_sandbox: AsyncSandbox):
12+
execution = await async_sandbox.run_code(
13+
"const message: string = 'Hello, World!'; console.log(message);", language="ts"
14+
)
15+
assert execution.logs.stdout == ["Hello, World!\n"]
16+
17+
18+
async def test_ts_kernel_errors(async_sandbox: AsyncSandbox):
19+
execution = await async_sandbox.run_code(
20+
"import x from 'module';", language="ts"
21+
)
22+
assert execution.error is not None
23+
assert execution.error.name == "TypeScriptCompilerError"

python/tests/sync/test_default_kernels.py

+12
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,15 @@ def test_r_kernel(sandbox: Sandbox):
1818
def test_java_kernel(sandbox: Sandbox):
1919
execution = sandbox.run_code('System.out.println("Hello, World!")', language="java")
2020
assert execution.logs.stdout[0] == "Hello, World!"
21+
22+
23+
@pytest.mark.skip_debug()
24+
def test_ts_kernel(sandbox: Sandbox):
25+
execution = sandbox.run_code("const message: string = 'Hello, World!'; console.log(message)", language="ts")
26+
assert execution.logs.stdout == ["Hello, World!\n"]
27+
28+
29+
def test_ts_kernel_errors(sandbox: Sandbox):
30+
execution = sandbox.run_code("import x from 'module';", language="ts")
31+
assert execution.error is not None
32+
assert execution.error.name == "TypeScriptCompilerError"

0 commit comments

Comments
 (0)