Skip to content

armgit / E2B

Public Imported from GitHub
0

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

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

import { gitTest } from '../../setup.js'
import { cleanupBaseDir, createBaseDir } from './helpers.js'

gitTest('git init', async ({ sandbox }) => {
  const baseDir = await createBaseDir(sandbox)

  try {
    const repoPath = `${baseDir}/repo`

    await sandbox.git.init(repoPath, { initialBranch: 'main' })

    expect(await sandbox.files.exists(`${repoPath}/.git`)).toBe(true)
    const head = (
      await sandbox.commands.run(
        `git -C "${repoPath}" symbolic-ref --short HEAD`
      )
    ).stdout.trim()
    expect(head).toBe('main')
  } finally {
    await cleanupBaseDir(sandbox, baseDir)
  }
})