Files
fete/frontend/src/components/__tests__/AttendeeList.spec.ts
nitrix 763811fce6
All checks were successful
CI / backend-test (push) Successful in 59s
CI / frontend-test (push) Successful in 23s
CI / frontend-e2e (push) Successful in 1m11s
CI / build-and-publish (push) Has been skipped
Add organizer-only attendee list to event detail view (011)
New GET /events/{token}/attendees endpoint returns attendee names when
a valid organizer token is provided (403 otherwise). The frontend
conditionally renders the list below the attendee count for organizers,
silently degrading for visitors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:34:27 +01:00

51 lines
1.6 KiB
TypeScript

import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import AttendeeList from '../AttendeeList.vue'
describe('AttendeeList', () => {
it('renders attendee names as list items', () => {
const wrapper = mount(AttendeeList, {
props: { attendees: ['Alice', 'Bob', 'Charlie'] },
})
const items = wrapper.findAll('.attendee-list__item')
expect(items).toHaveLength(3)
expect(items[0]!.text()).toBe('Alice')
expect(items[1]!.text()).toBe('Bob')
expect(items[2]!.text()).toBe('Charlie')
})
it('shows empty state message when no attendees', () => {
const wrapper = mount(AttendeeList, {
props: { attendees: [] },
})
expect(wrapper.find('.attendee-list__empty').text()).toBe('No attendees yet.')
expect(wrapper.find('.attendee-list__items').exists()).toBe(false)
})
it('shows plural count heading for multiple attendees', () => {
const wrapper = mount(AttendeeList, {
props: { attendees: ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve'] },
})
expect(wrapper.find('.attendee-list__heading').text()).toBe('5 Attendees')
})
it('shows singular count heading for one attendee', () => {
const wrapper = mount(AttendeeList, {
props: { attendees: ['Alice'] },
})
expect(wrapper.find('.attendee-list__heading').text()).toBe('1 Attendee')
})
it('shows zero count heading for no attendees', () => {
const wrapper = mount(AttendeeList, {
props: { attendees: [] },
})
expect(wrapper.find('.attendee-list__heading').text()).toBe('0 Attendees')
})
})