Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Add register action test for Python SDK

Tomas Valenta01c64c3960aa
diff --git a/packages/js-sdk/test/action.test.mjs b/packages/js-sdk/test/action.test.mjs
new file mode 100644
index 000000000..f71545e1c
--- /dev/null
+++ b/packages/js-sdk/test/action.test.mjs
@@ -0,0 +1,16 @@
+import { Sandbox } from '../src'
+import { test, expect } from 'vitest'
+
+import { id } from './setup.mjs'
+
+test('register action', async () => {
+ const sandbox = await Sandbox.create({ id })
+
+ sandbox.registerAction('test', () => {
+ return 'test'
+ })
+
+ expect([sandbox.actions.values()].length).toEqual(1)
+
+ await sandbox.close()
+})
diff --git a/packages/python-sdk/tests/test_action.py b/packages/python-sdk/tests/test_action.py
new file mode 100644
index 000000000..0cb0bc654
--- /dev/null
+++ b/packages/python-sdk/tests/test_action.py
@@ -0,0 +1,10 @@
+from e2b import Sandbox
+
+
+def test_register_action():
+ sandbox = Sandbox()
+
+ sandbox.register_action("test", lambda sbx, args: "test")
+ assert len(sandbox.actions.values()) == 1
+
+ sandbox.close()