Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Fix sandboxID in tests

Tomas Valentae664d146c142
diff --git a/packages/js-sdk/src/sandbox/sandboxApi.ts b/packages/js-sdk/src/sandbox/sandboxApi.ts
index f16789f97..0f1f6c6ed 100644
--- a/packages/js-sdk/src/sandbox/sandboxApi.ts
+++ b/packages/js-sdk/src/sandbox/sandboxApi.ts
@@ -80,7 +80,7 @@ export class SandboxApi {
}
return res.data?.map((sandbox) => ({
- sandboxId: this.getSandboxId({sandboxId: sandbox.sandboxID, clientId: sandbox.clientID}),
+ sandboxId: this.getSandboxId({ sandboxId: sandbox.sandboxID, clientId: sandbox.clientID }),
templateId: sandbox.templateID,
...(sandbox.alias && { name: sandbox.alias }),
...(sandbox.metadata && { metadata: sandbox.metadata }),
@@ -132,13 +132,13 @@ export class SandboxApi {
}
if (compareVersions(res.data!.envdVersion, '0.1.0') < 0) {
- await this.kill(this.getSandboxId({sandboxId: res.data!.sandboxID, clientId: res.data!.clientID}), opts)
+ await this.kill(this.getSandboxId({ sandboxId: res.data!.sandboxID, clientId: res.data!.clientID }), opts)
throw new TemplateError(
'You need to update the template to use the new SDK. ' +
'You can do this by running `e2b template build` in the directory with the template.'
)
}
- return this.getSandboxId({sandboxId: res.data!.sandboxID, clientId: res.data!.clientID})
+ return this.getSandboxId({ sandboxId: res.data!.sandboxID, clientId: res.data!.clientID })
}
private static timeoutToSeconds(timeout: number): number {
diff --git a/packages/js-sdk/tests/api/kill.test.ts b/packages/js-sdk/tests/api/kill.test.ts
index aa4457240..2e928befe 100644
--- a/packages/js-sdk/tests/api/kill.test.ts
+++ b/packages/js-sdk/tests/api/kill.test.ts
@@ -4,10 +4,10 @@ import { sandboxTest, isDebug } from '../setup.js'
import { Sandbox } from '../../src'
sandboxTest.skipIf(isDebug)('kill existing sandbox', async ({ sandbox }) => {
- await Sandbox.kill(sandbox.sandboxID)
+ await Sandbox.kill(sandbox.sandboxId)
const list = await Sandbox.list()
- expect(list.map(s => s.sandboxID)).not.toContain(sandbox.sandboxID)
+ expect(list.map(s => s.sandboxId)).not.toContain(sandbox.sandboxId)
})
sandboxTest.skipIf(isDebug)('kill non-existing sandbox', async () => {
diff --git a/packages/js-sdk/tests/api/list.test.ts b/packages/js-sdk/tests/api/list.test.ts
index 31746a46c..b121a88f1 100644
--- a/packages/js-sdk/tests/api/list.test.ts
+++ b/packages/js-sdk/tests/api/list.test.ts
@@ -6,5 +6,5 @@ import { sandboxTest, isDebug } from '../setup.js'
sandboxTest.skipIf(isDebug)('list sandboxes', async ({ sandbox }) => {
const sandboxes = await Sandbox.list()
assert.isAtLeast(sandboxes.length, 1)
- assert.include(sandboxes.map((s) => s.sandboxID), sandbox.sandboxID)
+ assert.include(sandboxes.map((s) => s.sandboxId), sandbox.sandboxId)
})
diff --git a/packages/js-sdk/tests/runtimes/bun/run.test.ts b/packages/js-sdk/tests/runtimes/bun/run.test.ts
index c376b9c19..02c226ff2 100644
--- a/packages/js-sdk/tests/runtimes/bun/run.test.ts
+++ b/packages/js-sdk/tests/runtimes/bun/run.test.ts
@@ -1,8 +1,8 @@
-import { expect, test } from "bun:test";
-import { Sandbox } from "../../../src";
+import { expect, test } from 'bun:test'
+import { Sandbox } from '../../../src'
-test("Bun test", async () => {
- const sbx = await Sandbox.create("base", { timeoutMs: 5_000 })
+test('Bun test', async () => {
+ const sbx = await Sandbox.create('base', { timeoutMs: 5_000 })
try {
const isRunning = await sbx.isRunning()
expect(isRunning).toBeTruthy()
@@ -15,4 +15,5 @@ test("Bun test", async () => {
expect(cmd.stdout).toEqual(`${text}\n`)
} finally {
await sbx.kill()
- }});
+ }
+})
diff --git a/packages/js-sdk/tests/sandbox/connect.test.ts b/packages/js-sdk/tests/sandbox/connect.test.ts
index b5081f537..5dc09fa21 100644
--- a/packages/js-sdk/tests/sandbox/connect.test.ts
+++ b/packages/js-sdk/tests/sandbox/connect.test.ts
@@ -10,7 +10,7 @@ test('connect', async () => {
const isRunning = await sbx.isRunning()
assert.isTrue(isRunning)
- const sbxConnection = await Sandbox.connect(sbx.sandboxID)
+ const sbxConnection = await Sandbox.connect(sbx.sandboxId)
const isRunning2 = await sbxConnection.isRunning()
assert.isTrue(isRunning2)
} finally {
diff --git a/packages/js-sdk/tests/sandbox/create.test.ts b/packages/js-sdk/tests/sandbox/create.test.ts
index 5e4d7aa5c..934f6a30b 100644
--- a/packages/js-sdk/tests/sandbox/create.test.ts
+++ b/packages/js-sdk/tests/sandbox/create.test.ts
@@ -22,7 +22,7 @@ test.skipIf(isDebug)('metadata', async () => {
try {
const sbxs = await Sandbox.list()
- const sbxInfo = sbxs.find((s) => s.sandboxID === sbx.sandboxID)
+ const sbxInfo = sbxs.find((s) => s.sandboxId === sbx.sandboxId)
assert.deepEqual(sbxInfo?.metadata, metadata)
} finally {
diff --git a/packages/js-sdk/tests/sandbox/kill.test.ts b/packages/js-sdk/tests/sandbox/kill.test.ts
index 2ac2a88b9..b59d4e7ac 100644
--- a/packages/js-sdk/tests/sandbox/kill.test.ts
+++ b/packages/js-sdk/tests/sandbox/kill.test.ts
@@ -7,5 +7,5 @@ sandboxTest.skipIf(isDebug)('kill', async ({ sandbox }) => {
await sandbox.kill()
const list = await Sandbox.list()
- expect(list.map(s => s.sandboxID)).not.toContain(sandbox.sandboxID)
+ expect(list.map(s => s.sandboxId)).not.toContain(sandbox.sandboxId)
})