test: remediate audit findings for task log viewer, report card and logger tests

This commit is contained in:
2026-03-03 21:01:24 +03:00
parent a9c0d55ec8
commit 1eb4b26254
11 changed files with 244 additions and 61 deletions

View File

@@ -2,7 +2,7 @@
* @vitest-environment jsdom
*/
// [DEF:frontend.src.lib.components.reports.__tests__.report_card.ux:Module]
// @TIER: STANDARD
// @TIER: CRITICAL
// @SEMANTICS: reports, ux-tests, card, states, recovery
// @PURPOSE: Test UX states and transitions for ReportCard component
// @LAYER: UI
@@ -70,6 +70,33 @@ describe('ReportCard UX Contract', () => {
// Check fallback type (the profile itself returns 'reports.unknown_type' string which doesn't get translated by $t in the mock if it's returning the key)
expect(screen.getByText('reports.unknown_type')).toBeDefined();
});
// @TEST_FIXTURE valid_report_card
it('should render valid_report_card correctly', () => {
const validReportCard = {
task_type: "migration",
status: "success",
summary: "Test Summary",
updated_at: "2024-01-01"
};
render(ReportCard, { report: validReportCard });
expect(screen.getByText('Test Summary')).toBeDefined();
expect(screen.getByText('Success')).toBeDefined();
});
// @TEST_EDGE empty_report_object
it('should handle completely empty report object gracefully', () => {
render(ReportCard, { report: {} });
const placeholders = screen.getAllByText('Not provided');
expect(placeholders.length).toBeGreaterThan(0);
});
// @TEST_EDGE random_status
it('should render random status directly if no translation matches', () => {
render(ReportCard, { report: { status: "unknown_status_code" } });
expect(screen.getByText('unknown_status_code')).toBeDefined();
});
});
// [/DEF:frontend.src.lib.components.reports.__tests__.report_card.ux:Module]