diff --git a/api-v3/test/unit/dashboard-service.test.ts b/api-v3/test/unit/dashboard-service.test.ts index f030d9b..52eb926 100644 --- a/api-v3/test/unit/dashboard-service.test.ts +++ b/api-v3/test/unit/dashboard-service.test.ts @@ -2,22 +2,22 @@ import { strict as assert } from 'node:assert'; import test from 'node:test'; import { DashboardService } from '../../src/dashboard/dashboard.service'; -test('DashboardService returns F4 operational counts and recent activity consistently', async () => { +test('DashboardService returns F5 operational counts and inspector activity consistently', async () => { const recent = [{ id: 'event-id', - occurredAt: new Date('2026-08-13T12:00:00.000Z'), - actorUsername: 'admin', - action: 'AUTH_LOGIN_SUCCESS', - entityType: 'auth_session', - entityId: 'session-id', + occurredAt: new Date('2026-09-08T12:00:00.000Z'), + actorUsername: 'inspector1', + action: 'INSPECTION_STARTED', + entityType: 'inspection_visit', + entityId: 'visit-id', }]; const manager = { query: async (sql: string) => { if (sql.includes('COUNT(*) FROM users')) { return [{ activeUsers: '4', inactiveUsers: '2', activeSessions: '3', - totalAssets: '12', assetsNeedValidation: '4', assetsWithoutGeometry: '6', plannedInspections: '2', - openFindings: '8', findingsWithoutControlDate: '5', overdueControls: '2', controlsNext30Days: '3', + totalAssets: '0', assetsNeedValidation: '0', assetsWithoutGeometry: '0', plannedInspections: '2', + openFindings: '8', actsInFollowUp: '6', findingsWithoutControlDate: '5', overdueControls: '2', controlsNext30Days: '3', reportsWorking: '1', reportsOfficialized: '2', sealedActsWithoutReport: '4', }]; } @@ -31,14 +31,15 @@ test('DashboardService returns F4 operational counts and recent activity consist const result = await new DashboardService(dataSource as never).summary(); assert.deepEqual(result.counts, { - totalAssets: 12, - assetsNeedValidation: 4, - assetsWithoutGeometry: 6, + totalAssets: 0, + assetsNeedValidation: 0, + assetsWithoutGeometry: 0, plannedInspections: 2, activeUsers: 4, inactiveUsers: 2, activeSessions: 3, openFindings: 8, + actsInFollowUp: 6, findingsWithoutControlDate: 5, overdueControls: 2, controlsNext30Days: 3, @@ -46,7 +47,8 @@ test('DashboardService returns F4 operational counts and recent activity consist reportsOfficialized: 2, sealedActsWithoutReport: 4, }); - assert.equal(result.recentAudit, recent); + assert.deepEqual(result.recentInspectorActivity, recent); + assert.equal('recentAudit' in result, false); assert.deepEqual(result.upcomingControls, []); assert.equal(typeof result.generatedAt, 'string'); });