Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Simplify tests

Jakub Novakfe78c0320d5e
diff --git a/packages/js-sdk/tests/sandbox/pty/ptyCreate.test.ts b/packages/js-sdk/tests/sandbox/pty/ptyCreate.test.ts
index a64d7f891..5a0b98c58 100644
--- a/packages/js-sdk/tests/sandbox/pty/ptyCreate.test.ts
+++ b/packages/js-sdk/tests/sandbox/pty/ptyCreate.test.ts
@@ -1,7 +1,7 @@
import { sandboxTest } from '../../setup'
import { assert } from 'vitest'
-sandboxTest('should create a PTY and execute commands', async ({ sandbox }) => {
+sandboxTest('create PTY', async ({ sandbox }) => {
let output = ''
const decoder = new TextDecoder()
const appendData = (data: Uint8Array) => {
@@ -17,12 +17,9 @@ sandboxTest('should create a PTY and execute commands', async ({ sandbox }) => {
await sandbox.pty.sendInput(
terminal.pid,
- new Uint8Array(Buffer.from('echo $ABC\n'))
- )
- await sandbox.pty.sendInput(
- terminal.pid,
- new Uint8Array(Buffer.from('exit\n'))
+ new Uint8Array(Buffer.from('echo $ABC\nexit\n'))
)
+
await terminal.wait()
assert.equal(terminal.exitCode, 0)
diff --git a/packages/js-sdk/tests/sandbox/pty/resize.test.ts b/packages/js-sdk/tests/sandbox/pty/resize.test.ts
index c48ad8b3b..21bb87829 100644
--- a/packages/js-sdk/tests/sandbox/pty/resize.test.ts
+++ b/packages/js-sdk/tests/sandbox/pty/resize.test.ts
@@ -16,11 +16,7 @@ sandboxTest('resize', async ({ sandbox }) => {
await sandbox.pty.sendInput(
terminal.pid,
- new Uint8Array(Buffer.from('tput cols\n'))
- )
- await sandbox.pty.sendInput(
- terminal.pid,
- new Uint8Array(Buffer.from('exit\n'))
+ new Uint8Array(Buffer.from('tput cols\nexit\n'))
)
await terminal.wait()
@@ -37,11 +33,7 @@ sandboxTest('resize', async ({ sandbox }) => {
await sandbox.pty.resize(resizedTerminal.pid, { cols: 100, rows: 24 })
await sandbox.pty.sendInput(
resizedTerminal.pid,
- new Uint8Array(Buffer.from('tput cols\n'))
- )
- await sandbox.pty.sendInput(
- resizedTerminal.pid,
- new Uint8Array(Buffer.from('exit\n'))
+ new Uint8Array(Buffer.from('tput cols\nexit\n'))
)
await resizedTerminal.wait()
diff --git a/packages/python-sdk/tests/sync/sandbox_sync/pty/test_pty.py b/packages/python-sdk/tests/sync/sandbox_sync/pty/test_pty.py
index b36d0af5a..6ed9219f2 100644
--- a/packages/python-sdk/tests/sync/sandbox_sync/pty/test_pty.py
+++ b/packages/python-sdk/tests/sync/sandbox_sync/pty/test_pty.py
@@ -10,9 +10,7 @@ def test_pty(sandbox: Sandbox):
PtySize(80, 24), envs={"ABC": "123"}, cwd="/"
)
- sandbox.pty.send_stdin(terminal.pid, b"echo $ABC\n")
- sandbox.pty.send_stdin(terminal.pid, b"pwd\n")
- sandbox.pty.send_stdin(terminal.pid, b"logout\n")
+ sandbox.pty.send_stdin(terminal.pid, b"echo $ABC\nexit\n")
output = []
result = terminal.wait(on_pty=lambda x: append_data(output, x))
diff --git a/packages/python-sdk/tests/sync/sandbox_sync/pty/test_resize.py b/packages/python-sdk/tests/sync/sandbox_sync/pty/test_resize.py
index 741105ca8..be7d3c806 100644
--- a/packages/python-sdk/tests/sync/sandbox_sync/pty/test_resize.py
+++ b/packages/python-sdk/tests/sync/sandbox_sync/pty/test_resize.py
@@ -8,8 +8,7 @@ def test_resize(sandbox: Sandbox):
terminal = sandbox.pty.create(PtySize(cols=80, rows=24))
- sandbox.pty.send_stdin(terminal.pid, b"tput cols\n")
- sandbox.pty.send_stdin(terminal.pid, b"exit\n")
+ sandbox.pty.send_stdin(terminal.pid, b"tput cols\nexit\n")
output = []
result = terminal.wait(on_pty=lambda x: append_data(output, x))
@@ -20,8 +19,7 @@ def test_resize(sandbox: Sandbox):
terminal = sandbox.pty.create(PtySize(cols=80, rows=24))
sandbox.pty.resize(terminal.pid, PtySize(cols=100, rows=24))
- sandbox.pty.send_stdin(terminal.pid, b"tput cols\n")
- sandbox.pty.send_stdin(terminal.pid, b"exit\n")
+ sandbox.pty.send_stdin(terminal.pid, b"tput cols\nexit\n")
output = []
result = terminal.wait(on_pty=lambda x: append_data(output, x))