import { describe, it, expect, vi } from 'vitest';
import { Award, Flag, Globe, MapIcon, Plane, Star } from 'lucide-react';
import { fireEvent, render, screen } from '../../../helpers/render';
import MAtlasStatsCard from '../../../../src/mobile/screens/atlas/MAtlasStatsCard';
import type { GlobeStat } from '../../../../src/components/AtlasGlobe/GlobeStatsBar';
// FE-MOB-ATLAS-010 to FE-MOB-ATLAS-012
const stat = (key: string, value: number | string, label: string, icon = Flag): GlobeStat => ({ key, value, label, icon, onClick: vi.fn() });
const stats: GlobeStat[] = [
stat('countries', 37, 'Countries'),
stat('continents', 6, 'Continents', Globe),
stat('regions', 42, 'Regions', MapIcon),
stat('flights', '152k', 'Flight km', Plane),
stat('badges', 22, 'Badges', Award),
stat('wishlist', 4, 'Wishlist', Star),
];
describe('MAtlasStatsCard', () => {
it('FE-MOB-ATLAS-010: shows the five phone figures in their order', () => {
render();
const labels = screen.getAllByRole('button').map((b) => b.textContent);
expect(labels).toEqual(['37Countries', '6Continents', '42Regions', '22Badges', '4Wishlist']);
});
it('FE-MOB-ATLAS-011: leaves out the figures the phone card has no room for', () => {
render();
expect(screen.queryByText('Flight km')).not.toBeInTheDocument();
});
it('FE-MOB-ATLAS-012: a column opens what it counts', () => {
render();
fireEvent.click(screen.getByText('Badges'));
expect(stats[4]?.onClick).toHaveBeenCalledTimes(1);
});
});