import { describe, expect, it } from 'vitest'
import { BINARY_TARGETS, buildBinaryConfig } from '../src/dist/buildBinary.js'

describe('buildBinaryConfig (T16)', () => {
  it('produces a bun --compile spec per target with cli.ts entry', () => {
    for (const target of BINARY_TARGETS) {
      const spec = buildBinaryConfig(target)
      expect(spec.tool).toBe('bun')
      expect(spec.entry).toBe('src/cli.ts')
      expect(spec.target).toBe(target)
      expect(spec.bunTarget).toContain('bun-')
      expect(spec.outfile).toContain(target)
    }
  })

  it('carries the INV11 forbidden-dep tripwire (no terminal parser in the bundle)', () => {
    const spec = buildBinaryConfig('darwin-arm64')
    expect(spec.forbiddenDeps).toContain('xterm')
    expect(spec.forbiddenDeps).toContain('ansi')
  })

  it('covers the four supported triples', () => {
    expect([...BINARY_TARGETS].sort()).toEqual(
      ['darwin-arm64', 'darwin-x64', 'linux-arm64', 'linux-x64'],
    )
  })
})
