test: update tests to match translated share link button and desktop two-column map layout

- 'Remove share link' → 'Delete link' (now uses share.deleteLink i18n key)
- FE-PAGE-PUBLICJOURNEY-009/012: map tab no longer exists in desktop two-column
  layout; map is always rendered in the sidebar — tests updated to verify the
  journey-map testid is present without requiring a tab click
This commit is contained in:
jubnl
2026-04-21 22:51:48 +02:00
parent 288d33ba42
commit a8c27f9d4a
2 changed files with 15 additions and 29 deletions
+4 -4
View File
@@ -1468,7 +1468,7 @@ describe('JourneyDetailPage', () => {
// ── FE-PAGE-JOURNEYDETAIL-074 ────────────────────────────────────────── // ── FE-PAGE-JOURNEYDETAIL-074 ──────────────────────────────────────────
describe('FE-PAGE-JOURNEYDETAIL-074: Delete share link removes it', () => { describe('FE-PAGE-JOURNEYDETAIL-074: Delete share link removes it', () => {
it('clicking "Remove share link" calls DELETE and returns to create state', async () => { it('clicking "Delete link" calls DELETE and returns to create state', async () => {
const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime }); const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime });
let deleteCalled = false; let deleteCalled = false;
@@ -1493,10 +1493,10 @@ describe('JourneyDetailPage', () => {
await openSettingsDialog(user); await openSettingsDialog(user);
await waitFor(() => { await waitFor(() => {
expect(screen.getByText('Remove share link')).toBeInTheDocument(); expect(screen.getByText('Delete link')).toBeInTheDocument();
}); });
await user.click(screen.getByText('Remove share link')); await user.click(screen.getByText('Delete link'));
await waitFor(() => { await waitFor(() => {
expect(deleteCalled).toBe(true); expect(deleteCalled).toBe(true);
@@ -2905,7 +2905,7 @@ describe('JourneyDetailPage', () => {
// The permission toggles show Timeline, Gallery, Map labels within the share section // The permission toggles show Timeline, Gallery, Map labels within the share section
// These reuse the same i18n keys as the main tab bar // These reuse the same i18n keys as the main tab bar
expect(screen.getByText('Remove share link')).toBeInTheDocument(); expect(screen.getByText('Delete link')).toBeInTheDocument();
expect(screen.getByText('Copy')).toBeInTheDocument(); expect(screen.getByText('Copy')).toBeInTheDocument();
}); });
}); });
+9 -23
View File
@@ -234,28 +234,20 @@ describe('JourneyPublicPage', () => {
} }
}); });
it('FE-PAGE-PUBLICJOURNEY-009: map tab switches view', async () => { it('FE-PAGE-PUBLICJOURNEY-009: map is always visible in desktop two-column layout', async () => {
setupSuccess(); setupSuccess();
render(<JourneyPublicPage />); render(<JourneyPublicPage />);
await waitFor(() => { await waitFor(() => {
expect(screen.getByText('Tokyo 2026')).toBeInTheDocument(); expect(screen.getByText('Tokyo 2026')).toBeInTheDocument();
}); });
const buttons = screen.getAllByRole('button'); // Desktop two-column: map sidebar is always rendered alongside the timeline;
const mapBtn = buttons.find( // there is no standalone "Map" tab button on desktop.
btn => btn.textContent && /map/i.test(btn.textContent),
);
expect(mapBtn).toBeDefined();
if (mapBtn) {
fireEvent.click(mapBtn);
// After clicking map tab, the timeline entries should no longer be visible
// and the map view content should be rendered (even if JourneyMap errors internally
// due to jsdom limitations, the tab state switches)
await waitFor(() => { await waitFor(() => {
// Shibuya Crossing (timeline-only) should not appear once map is active expect(screen.getByTestId('journey-map')).toBeInTheDocument();
expect(screen.queryByText('Shibuya Crossing')).not.toBeInTheDocument();
}); });
} // Timeline entries remain visible (two-column shows both simultaneously)
expect(screen.getByText('Shibuya Crossing')).toBeInTheDocument();
}); });
it('FE-PAGE-PUBLICJOURNEY-010: shows journey stats', async () => { it('FE-PAGE-PUBLICJOURNEY-010: shows journey stats', async () => {
@@ -303,24 +295,18 @@ describe('JourneyPublicPage', () => {
}); });
// FE-PAGE-PUBLICJOURNEY-012 // FE-PAGE-PUBLICJOURNEY-012
it('FE-PAGE-PUBLICJOURNEY-012: tab switching from timeline to map shows map component', async () => { it('FE-PAGE-PUBLICJOURNEY-012: map component renders with located entries in desktop two-column layout', async () => {
const user = userEvent.setup();
setupSuccess(); setupSuccess();
render(<JourneyPublicPage />); render(<JourneyPublicPage />);
await waitFor(() => { await waitFor(() => {
expect(screen.getByText('Tokyo 2026')).toBeInTheDocument(); expect(screen.getByText('Tokyo 2026')).toBeInTheDocument();
}); });
const mapBtn = screen.getAllByRole('button').find( // Desktop two-column: map sidebar is always rendered; no tab click required.
btn => btn.textContent && /map/i.test(btn.textContent),
);
expect(mapBtn).toBeDefined();
await user.click(mapBtn!);
await waitFor(() => { await waitFor(() => {
expect(screen.getByTestId('journey-map')).toBeInTheDocument(); expect(screen.getByTestId('journey-map')).toBeInTheDocument();
}); });
// Map receives entries with lat/lng // Both fixture entries have coordinates → map receives 2 located entries
expect(screen.getByTestId('journey-map').textContent).toContain('2'); expect(screen.getByTestId('journey-map').textContent).toContain('2');
}); });