Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(dashboard): count sessions without statistics
Yudhi Armyndharis2f3c49fba69c
diff --git a/dashboard/src/pages/Dashboard.test.ts b/dashboard/src/pages/Dashboard.test.tsindex 1c860c512..3430c02fc 100644--- a/dashboard/src/pages/Dashboard.test.ts+++ b/dashboard/src/pages/Dashboard.test.ts@@ -173,6 +173,15 @@ test('a session last active a few hours ago reads in hours, not as a date', asynassert.equal(document.querySelector('.last-active')?.textContent, '5 hours ago');});+// The harness refuses the session statistics, as the gateway does a failed or unsent read: the count of sessions is+// then the list's own, not a total of zero beside the rows on screen.+test('a session list without statistics is counted by its own length', async () => {+ sessionList = [READY_SESSION];+ renderDashboard();+ await rtl.screen.findByText('Main');+ assert.equal(document.querySelector('.section-subtitle')?.textContent, 'Showing 1 of 1 sessions');+});+test('a read-only key is offered no Disconnect', async () => {webhooksStatus = 403;sessionList = [READY_SESSION];diff --git a/dashboard/src/pages/Dashboard.tsx b/dashboard/src/pages/Dashboard.tsxindex be8e062c1..db484e4bb 100644--- a/dashboard/src/pages/Dashboard.tsx+++ b/dashboard/src/pages/Dashboard.tsx@@ -146,7 +146,7 @@ export function Dashboard() {<div className="section-header"><h2>{t('dashboard.sessionsOverview')}</h2><span className="section-subtitle">- {t('dashboard.showingSessions', { shown: sessions.length, total: stats?.total ?? 0 })}+ {t('dashboard.showingSessions', { shown: sessions.length, total: stats?.total ?? sessions.length })}</span></div>