// @vitest-environment jsdom import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'; import {cleanup, screen} from '@testing-library/react'; import AccountInfoCard from './AccountInfoCard.jsx'; import {fetchRoutes, json} from '../test/fetchRoutes.js'; import {renderWithProviders} from '../test/renderWithProviders.jsx'; vi.mock('react-i18next', () => import('../test/i18n-mock.js')); beforeEach(() => localStorage.setItem('tbp_session', '1')); afterEach(() => { cleanup(); localStorage.clear(); }); describe('AccountInfoCard', () => { it('shows the role by its translated name, not the enum value', async () => { fetchRoutes({'GET /api/users/me': json(200, {email: 'a@b.de', role: 'PLATFORM_ADMIN', settings: {}})}); renderWithProviders(, {path: '/settings', entries: ['/settings']}); expect(await screen.findByText('ROLES.PLATFORM_ADMIN')).toBeTruthy(); expect(screen.queryByText('PLATFORM_ADMIN')).toBeNull(); }); });