mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-21 22:46:32 +00:00
test(tours): update planner wiring and stabilize date fixture
This commit is contained in:
@@ -689,14 +689,21 @@ describe('PlaceInspector', () => {
|
||||
});
|
||||
|
||||
it('FE-PLANNER-INSPECTOR-2472: the own e-mail and hours show, the hours ahead of looked-up ones', async () => {
|
||||
const user = userEvent.setup();
|
||||
const week = JSON.stringify(Array.from({ length: 7 }, (_, i) => (i === 6 ? { closed: true } : { closed: false, open: '08:00', close: '12:00' })));
|
||||
const p = buildPlace({ id: 302, email: 'hi@bakery.test', opening_hours: week } as any);
|
||||
render(<PlaceInspector {...defaultProps} place={p} />);
|
||||
expect(screen.getByRole('link', { name: /hi@bakery\.test/ })).toHaveAttribute('href', 'mailto:hi@bakery.test');
|
||||
expect(screen.getByText('Opening Hours')).toBeInTheDocument();
|
||||
await user.click(screen.getByRole('button', { expanded: false, name: /08:00|Show/ }));
|
||||
expect(screen.getByText(/Sunday: Closed/)).toBeInTheDocument();
|
||||
vi.useFakeTimers({ toFake: ['Date'] });
|
||||
try {
|
||||
vi.setSystemTime(new Date('2026-06-02T12:00:00Z'));
|
||||
const user = userEvent.setup();
|
||||
const week = JSON.stringify(Array.from({ length: 7 }, (_, i) => (i === 6 ? { closed: true } : { closed: false, open: '08:00', close: '12:00' })));
|
||||
const placeWithHours = { id: 302, email: 'hi@bakery.test', opening_hours: week };
|
||||
const p = buildPlace(placeWithHours);
|
||||
render(<PlaceInspector {...defaultProps} place={p} />);
|
||||
expect(screen.getByRole('link', { name: /hi@bakery\.test/ })).toHaveAttribute('href', 'mailto:hi@bakery.test');
|
||||
expect(screen.getByText('Opening Hours')).toBeInTheDocument();
|
||||
await user.click(screen.getByRole('button', { expanded: false, name: /08:00|Show/ }));
|
||||
expect(screen.getByText(/Sunday: Closed/)).toBeInTheDocument();
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
|
||||
// ── File size display ──────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user