Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Correct counted-navigation fixtures without weakening names

pulse-triage[bot]ee9b7261a896
diff --git a/frontend-modern/src/__tests__/App.architecture.test.ts b/frontend-modern/src/__tests__/App.architecture.test.ts
index 465537c89c..959f8fe7a0 100644
--- a/frontend-modern/src/__tests__/App.architecture.test.ts
+++ b/frontend-modern/src/__tests__/App.architecture.test.ts
@@ -793,7 +793,8 @@ describe('App architecture', () => {
'type MobileNavBarPrimaryTab as PrimaryTab,\n type MobileNavBarUtilityTab as UtilityTab,',
);
expect(appLayoutSource).toContain("const NAV_TAB_ICON_CLASS = 'w-4 h-4 shrink-0';");
- expect(appLayoutSource).toContain('function getDesktopUtilityTabAriaLabel(tab: UtilityTab)');
+ expect(appLayoutSource).toContain("} from '@/components/shared/mobileNavBarModel';");
+ expect(appLayoutSource).not.toContain('function getDesktopUtilityTabAriaLabel');
expect(appLayoutSource).toContain('return `${count} ${tab.label}`;');
expect(appLayoutSource).toContain('const primaryTabsSource = createMemo<PrimaryTab[]>(() =>');
expect(appLayoutSource).toContain("id: 'proxmox',");
diff --git a/frontend-modern/src/__tests__/AppLayout.test.tsx b/frontend-modern/src/__tests__/AppLayout.test.tsx
index a508b84102..8d67198c3b 100644
--- a/frontend-modern/src/__tests__/AppLayout.test.tsx
+++ b/frontend-modern/src/__tests__/AppLayout.test.tsx
@@ -280,7 +280,11 @@ describe('AppLayout navigation icons', () => {
});
expect(desktopPatrolTab).toHaveTextContent('Patrol');
expect(desktopPatrolTab).toHaveTextContent('2');
- expect(desktopPatrolTab.textContent?.replace(/\s+/g, ' ').trim()).toBe('Patrol 2');
+ // jsdom includes the hidden compact label and SVG title in textContent.
+ // Assert the actual word boundary before the badge instead.
+ expect(desktopPatrolTab.querySelector('[class~="xs:hidden"]')?.nextSibling?.textContent).toBe(
+ ' ',
+ );
expect(within(systemGroup as HTMLElement).queryByText('Needs Attention')).toBeNull();
const mobileNav = screen.getByRole('navigation', { name: 'Mobile navigation' });
@@ -289,7 +293,9 @@ describe('AppLayout navigation icons', () => {
});
expect(mobilePatrolTab).toHaveTextContent('Patrol');
expect(mobilePatrolTab).toHaveTextContent('2');
- expect(mobilePatrolTab.textContent?.replace(/\s+/g, ' ').trim()).toBe('Patrol 2');
+ // The visible label precedes the icon/badge wrapper in DOM order.
+ expect(mobilePatrolTab.firstElementChild).toHaveClass('order-2');
+ expect(mobilePatrolTab.firstElementChild?.textContent).toBe('Patrol ');
expect(within(mobileNav).queryByText('Needs Attention')).toBeNull();
});
@@ -322,7 +328,7 @@ describe('AppLayout navigation icons', () => {
expect(actionsTab.className).toContain('text-blue-600');
expect(actionsTab).toHaveAttribute('href', '/actions');
expect(actionsTab).toHaveAttribute('aria-current', 'page');
- expect(actionsTab.textContent?.replace(/\s+/g, ' ').trim()).toBe('Actions 3');
+ expect(actionsTab.querySelector('[class~="xs:hidden"]')?.nextSibling?.textContent).toBe(' ');
expect(within(systemGroup as HTMLElement).getByRole('link', { name: 'Patrol' })).toBeTruthy();
const mobileNav = screen.getByRole('navigation', { name: 'Mobile navigation' });
diff --git a/frontend-modern/src/components/shared/__tests__/MobileNavBar.test.tsx b/frontend-modern/src/components/shared/__tests__/MobileNavBar.test.tsx
index 3e93e4cccc..9327042b3b 100644
--- a/frontend-modern/src/components/shared/__tests__/MobileNavBar.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/MobileNavBar.test.tsx
@@ -229,7 +229,11 @@ describe('MobileNavBar', () => {
const nav = screen.getByRole('navigation', { name: 'Mobile navigation' });
const alertsLink = within(nav).getByRole('link', { name: 'Alerts 2 3' });
- expect(alertsLink).toHaveTextContent('Alerts 2 3');
+ // The text icon is deliberately a stub: its hidden "Icon" text is not
+ // a visible label. Test label order/boundaries and badge contents directly.
+ expect(alertsLink.firstElementChild).toHaveClass('order-2');
+ expect(alertsLink.firstElementChild?.textContent).toBe('Alerts ');
+ expect(alertsLink.querySelector('.absolute')).toHaveTextContent('2 3');
expect(alertsLink).toHaveAccessibleDescription('2 critical, 3 warning');
expect(within(nav).getByRole('link', { name: 'Patrol: 2 open work items' })).toHaveTextContent(
'Patrol 2',