import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import RewardConfirmDialog from '../RewardConfirmDialog.vue'
import type { RewardStatus } from '@/common/models'

const ModalDialogStub = {
  template: '<div><slot /></div>',
  props: ['title', 'subtitle', 'imageUrl'],
}

describe('RewardConfirmDialog', () => {
  it('renders "Grant Reward" title and reward name subtitle', () => {
    const reward: RewardStatus = {
      id: 'reward-1',
      name: 'Ice Cream',
      cost: 50,
      points_needed: 0,
      redeeming: false,
      image_id: '',
    }
    const wrapper = mount(RewardConfirmDialog, {
      props: { reward, childName: 'Test Child' },
      global: { stubs: { ModalDialog: ModalDialogStub } },
    })

    const dialog = wrapper.findComponent(ModalDialogStub)
    expect(dialog.props('title')).toBe('Grant Reward')
    expect(dialog.props('subtitle')).toBe('Ice Cream')
  })
})
