Public Access
Get started links to registration and says an admin approves accounts. Back navigation restores the library scroll; search no longer fills history. Steam and PSN unlink ask first. Any close marks news as seen. Confetti plays only when the level rises on the page. Count-ups respect reduced motion. Html lang follows the UI language. Add a 404 page, translated role and dialog close label.
26 lines
1008 B
React
26 lines
1008 B
React
// @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(<AccountInfoCard/>, {path: '/settings', entries: ['/settings']});
|
|
|
|
expect(await screen.findByText('ROLES.PLATFORM_ADMIN')).toBeTruthy();
|
|
expect(screen.queryByText('PLATFORM_ADMIN')).toBeNull();
|
|
});
|
|
});
|