test(f4): align legacy contracts with lifecycle model
This commit is contained in:
@@ -2,7 +2,7 @@ import { strict as assert } from 'node:assert';
|
||||
import test from 'node:test';
|
||||
import { DashboardService } from '../../src/dashboard/dashboard.service';
|
||||
|
||||
test('DashboardService returns numeric counts and recent activity consistently', async () => {
|
||||
test('DashboardService returns F4 operational counts and recent activity consistently', async () => {
|
||||
const recent = [{
|
||||
id: 'event-id',
|
||||
occurredAt: new Date('2026-08-13T12:00:00.000Z'),
|
||||
@@ -17,9 +17,8 @@ test('DashboardService returns numeric counts and recent activity consistently',
|
||||
return [{
|
||||
activeUsers: '4', inactiveUsers: '2', activeSessions: '3',
|
||||
totalAssets: '12', assetsNeedValidation: '4', assetsWithoutGeometry: '6', plannedInspections: '2',
|
||||
openFindings: '8', awaitingCompanyResponse: '5', overdueCompanyResponses: '2',
|
||||
companyResponsesDueNext7Days: '1', awaitingVerificationSchedule: '4',
|
||||
overdueControls: '2', controlsNext30Days: '3',
|
||||
openFindings: '8', findingsWithoutControlDate: '5', overdueControls: '2', controlsNext30Days: '3',
|
||||
reportsWorking: '1', reportsOfficialized: '2', sealedActsWithoutReport: '4',
|
||||
}];
|
||||
}
|
||||
if (sql.includes('FROM inspection_findings finding')) return [];
|
||||
@@ -32,20 +31,20 @@ test('DashboardService returns numeric counts and recent activity consistently',
|
||||
|
||||
const result = await new DashboardService(dataSource as never).summary();
|
||||
assert.deepEqual(result.counts, {
|
||||
activeUsers: 4,
|
||||
inactiveUsers: 2,
|
||||
activeSessions: 3,
|
||||
totalAssets: 12,
|
||||
assetsNeedValidation: 4,
|
||||
assetsWithoutGeometry: 6,
|
||||
plannedInspections: 2,
|
||||
activeUsers: 4,
|
||||
inactiveUsers: 2,
|
||||
activeSessions: 3,
|
||||
openFindings: 8,
|
||||
awaitingCompanyResponse: 5,
|
||||
overdueCompanyResponses: 2,
|
||||
companyResponsesDueNext7Days: 1,
|
||||
awaitingVerificationSchedule: 4,
|
||||
findingsWithoutControlDate: 5,
|
||||
overdueControls: 2,
|
||||
controlsNext30Days: 3,
|
||||
reportsWorking: 1,
|
||||
reportsOfficialized: 2,
|
||||
sealedActsWithoutReport: 4,
|
||||
});
|
||||
assert.equal(result.recentAudit, recent);
|
||||
assert.deepEqual(result.upcomingControls, []);
|
||||
|
||||
Reference in New Issue
Block a user