// @vitest-environment happy-dom
import { describe, it, expect } from 'vitest'

import DownloadEventRow from '../../src/components/downloads/DownloadEventRow.vue'
import { freshPinia, mountComponent } from '../support/mountComponent.js'

describe('DownloadEventRow', () => {
  it('renders the mapped status label and platform', () => {
    const pinia = freshPinia()
    const now = new Date().toISOString()
    const event = {
      id: 1, status: 'ok', started_at: now, finished_at: now,
      platform: 'patreon', artist_name: 'Alice',
      files_count: 3, bytes_downloaded: 1000, error: null, summary: {},
    }
    const w = mountComponent(DownloadEventRow, { props: { event }, pinia })
    const t = w.text()
    expect(t).toContain('Completed') // downloadStatusLabel('ok')
    expect(t).toContain('Patreon')   // platformLabel via PlatformChip
  })
})
