Skip to content

armgit / E2B

Public Imported from GitHub
0

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

762 B
Raw Blame
import { assert } from 'vitest'

import { sandboxTest, isDebug } from '../setup.js'
import { Sandbox } from '../../src'

sandboxTest.skipIf(isDebug)(
  'pause sandbox',
  async ({ sandbox }) => {
    await Sandbox.pause(sandbox.sandboxId)
    assert.isFalse(
      await sandbox.isRunning(),
      'Sandbox should not be running after pause'
    )
  },
  120_000
)

sandboxTest.skipIf(isDebug)(
  'resume sandbox',
  async ({ sandbox }) => {
    await Sandbox.pause(sandbox.sandboxId)
    assert.isFalse(
      await sandbox.isRunning(),
      'Sandbox should not be running after pause'
    )

    await Sandbox.connect(sandbox.sandboxId)
    assert.isTrue(
      await sandbox.isRunning(),
      'Sandbox should be running after resume'
    )
  },
  120_000
)