import { describe, expect, it } from 'vitest'

import { inferColumnV0 } from './lifecycle-v0.js'

const base = { state: 'open' as const, labels: [] as string[], milestone: null }

describe('inferColumnV0', () => {
  it('closed issues are done', () => {
    expect(inferColumnV0({ ...base, state: 'closed' })).toBe('done')
  })

  it('open + labelled is triage', () => {
    expect(inferColumnV0({ ...base, labels: ['est/2d'] })).toBe('triage')
  })

  it('open + milestoned is triage', () => {
    expect(inferColumnV0({ ...base, milestone: { id: 6, title: 'P1', dueOn: null } })).toBe('triage')
  })

  it('open + bare is diagnosis', () => {
    expect(inferColumnV0(base)).toBe('diagnosis')
  })

  it('never guesses steeping or review in v0', () => {
    // even a closed, labelled, milestoned issue resolves to a real column, never the event-only ones
    const col = inferColumnV0({ ...base, labels: ['est/2d', 'p/1'], milestone: { id: 6, title: 'P1', dueOn: null } })
    expect(['steeping', 'review']).not.toContain(col)
  })
})
