Skip to content

armgit / E2B

Public Imported from GitHub
0

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

695 B
Raw Blame
import { expect } from 'vitest'

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

sandboxTest.skipIf(isDebug)('shorten timeout', async ({ sandbox }) => {
  await sandbox.setTimeout(5000)

  await wait(6000)

  expect(await sandbox.isRunning()).toBeFalsy()
})

sandboxTest.skipIf(isDebug)(
  'shorten then lengthen timeout',
  async ({ sandbox }) => {
    await sandbox.setTimeout(5000)

    await wait(1000)

    await sandbox.setTimeout(10000)

    await wait(6000)

    expect(await sandbox.isRunning()).toBeTruthy()
  }
)

sandboxTest.skipIf(isDebug)('get sandbox timeout', async ({ sandbox }) => {
  const { endAt } = await sandbox.getInfo()
  expect(endAt).toBeInstanceOf(Date)
})