mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-20 05:56:53 +00:00
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import { describe, expect, it } from 'vitest';
|
|
import PlaceHoverCard from './PlaceHoverCard';
|
|
|
|
describe('PlaceHoverCard', () => {
|
|
it('FE-MAP-HOVERCARD-001: says what the place is, which a round photo cannot', () => {
|
|
render(
|
|
<PlaceHoverCard
|
|
x={10}
|
|
y={20}
|
|
name="Museumsinsel"
|
|
categoryName="Sights"
|
|
categoryIcon="Landmark"
|
|
address="Bodestraße 1"
|
|
/>
|
|
);
|
|
|
|
expect(screen.getByText('Museumsinsel')).toBeInTheDocument();
|
|
expect(screen.getByText('Sights')).toBeInTheDocument();
|
|
expect(screen.getByText('Bodestraße 1')).toBeInTheDocument();
|
|
});
|
|
|
|
it('FE-MAP-HOVERCARD-002: shows a rating beside the name, and only when there is one', () => {
|
|
const { rerender } = render(<PlaceHoverCard x={0} y={0} name="Museumsinsel" rating={4} />);
|
|
expect(screen.getByText('4')).toBeInTheDocument();
|
|
|
|
rerender(<PlaceHoverCard x={0} y={0} name="Museumsinsel" rating={null} />);
|
|
expect(screen.queryByText('4')).toBeNull();
|
|
});
|
|
|
|
it('FE-MAP-HOVERCARD-003: never takes the pointer — it is a label, not a target', () => {
|
|
render(<PlaceHoverCard x={0} y={0} name="Museumsinsel" />);
|
|
expect(screen.getByTestId('tooltip')).toHaveStyle({ pointerEvents: 'none' });
|
|
});
|
|
});
|