// FE-W4GB-001 to FE-W4GB-004
import { describe, it, expect } from 'vitest'
import { fireEvent } from '@testing-library/react'
import { render, screen } from '../../../tests/helpers/render'
import GuestBadge from './GuestBadge'
describe('GuestBadge', () => {
it('FE-W4GB-001: renders the translated guest label with the accountless hint as title', () => {
render()
const pill = screen.getByTitle(/without an account/i)
expect(pill).toHaveTextContent('Guest')
expect(pill.querySelector('svg')).not.toBeNull()
})
it('FE-W4GB-002: sizes the label at 10px by default', () => {
render()
expect(screen.getByTitle(/without an account/i)).toHaveStyle({ fontSize: 'calc(10px * var(--fs-scale-caption, 1))' })
})
it('FE-W4GB-003: shrinks to 9px in the xs variant', () => {
render()
expect(screen.getByTitle(/without an account/i)).toHaveStyle({ fontSize: 'calc(9px * var(--fs-scale-caption, 1))' })
})
it('FE-W4GB-004: with customTooltip the hint moves from the native title into the app tooltip', async () => {
render()
expect(screen.queryByTitle(/without an account/i)).toBeNull()
fireEvent.mouseEnter(screen.getByText('Guest'))
expect(await screen.findByRole('tooltip')).toHaveTextContent(/without an account/i)
})
})