import { describe, expect, it } from 'vitest'
import { readFileSync } from 'node:fs'
import { join } from 'node:path'

describe('transport seams (W0 cycle-breaker)', () => {
  it('is a type-only module with no runtime side effects or transport deps', async () => {
    const src = readFileSync(
      join(import.meta.dirname, '..', 'src', 'transport', 'seams.ts'),
      'utf8',
    )
    // No runtime imports: the seam file must not pull ws/crypto/node runtime.
    expect(src).not.toMatch(/from ['"]ws['"]/)
    expect(src).not.toMatch(/from ['"]node:crypto['"]/)
    // Importing it must not throw or emit anything.
    const mod = await import('../src/transport/seams.js')
    expect(mod).toBeDefined()
    // Interfaces are erased at runtime, so the module has no runtime exports.
    expect(Object.keys(mod)).toHaveLength(0)
  })
})
