/**
 * (share/hooks — sector options map and display label branches).
 */
import { renderHook } from '@testing-library/react'

import { useBusinessSectorOptions } from '../use-business-sector-options'

jest.mock('next-intl', () => ({
  useTranslations: () => (key: string) => `t:${key}`,
}))

describe('[share/hooks/use-business-sector-options]', () => {
  describe('sectorSelectOptions', () => {
    it('maps every sector to a translated label (happy path)', () => {
      const { result } = renderHook(() => useBusinessSectorOptions())
      expect(result.current.sectorSelectOptions).toHaveLength(5)
      expect(result.current.sectorSelectOptions[0]).toEqual({
        value: 'FINANCE',
        label: 't:fields.business_sector.finance',
      })
    })
  })

  describe('getSectorDisplayLabel', () => {
    it('returns translated label for a known enum value', () => {
      const { result } = renderHook(() => useBusinessSectorOptions())
      expect(result.current.getSectorDisplayLabel('TECHNOLOGY')).toBe(
        't:fields.business_sector.technology'
      )
    })

    it('returns raw string when value is not in enum (legacy / API)', () => {
      const { result } = renderHook(() => useBusinessSectorOptions())
      expect(result.current.getSectorDisplayLabel('LEGACY_OR_API_VALUE')).toBe(
        'LEGACY_OR_API_VALUE'
      )
    })
  })
})
