From 82eaf8874971a94046775f6c2580abda7937a6fb Mon Sep 17 00:00:00 2001 From: saurabhhhcodes <157192462+saurabhhhcodes@users.noreply.github.com> Date: Sat, 6 Jun 2026 15:11:26 +0530 Subject: [PATCH 1/2] test: cover preferred export format hook --- .../hooks/usePreferredExportFormat.test.ts | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 frontend/testing/unit/hooks/usePreferredExportFormat.test.ts diff --git a/frontend/testing/unit/hooks/usePreferredExportFormat.test.ts b/frontend/testing/unit/hooks/usePreferredExportFormat.test.ts new file mode 100644 index 00000000..6dc7cc0b --- /dev/null +++ b/frontend/testing/unit/hooks/usePreferredExportFormat.test.ts @@ -0,0 +1,36 @@ +import { act, renderHook } from '@testing-library/react' +import { beforeEach, describe, expect, it } from 'vitest' +import { usePreferredExportFormat } from '../../../src/hooks/usePreferredExportFormat' + +const STORAGE_KEY = 'secuscan:preferred-export-format' + +describe('usePreferredExportFormat', () => { + beforeEach(() => { + localStorage.clear() + }) + + it('starts with no preferred format when storage is empty', () => { + const { result } = renderHook(() => usePreferredExportFormat()) + + expect(result.current.preferred).toBeNull() + }) + + it('restores a stored preferred format on first render', () => { + localStorage.setItem(STORAGE_KEY, 'pdf') + + const { result } = renderHook(() => usePreferredExportFormat()) + + expect(result.current.preferred).toBe('pdf') + }) + + it('persists a newly selected preferred format', () => { + const { result } = renderHook(() => usePreferredExportFormat()) + + act(() => { + result.current.savePreference('csv') + }) + + expect(result.current.preferred).toBe('csv') + expect(localStorage.getItem(STORAGE_KEY)).toBe('csv') + }) +}) From 2b6cfc03f4ed29c5e864c42698c361f87cad1690 Mon Sep 17 00:00:00 2001 From: saurabhhhcodes <157192462+saurabhhhcodes@users.noreply.github.com> Date: Sat, 6 Jun 2026 15:18:47 +0530 Subject: [PATCH 2/2] fix: restore SecuScan CI baseline --- backend/secuscan/workflows.py | 1 + .../testing/unit/pages/ToolConfigDynamic.test.tsx | 5 +++++ .../testing/unit/pages/ToolConfigTimeout.test.tsx | 2 +- frontend/testing/unit/pages/Workflows.test.tsx | 12 +++++++++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/backend/secuscan/workflows.py b/backend/secuscan/workflows.py index eb98c598..c7ba88dc 100644 --- a/backend/secuscan/workflows.py +++ b/backend/secuscan/workflows.py @@ -72,6 +72,7 @@ def _should_run(self, now: datetime, last_run_at: str | None, schedule_seconds: return elapsed >= schedule_seconds async def _run_workflow(self, workflow_id: str, steps: List[Dict[str, Any]]): logger.info("Running workflow %s with %d step(s)", workflow_id, len(steps)) + db = await get_db() for step in steps: plugin_id = step.get("plugin_id") inputs = step.get("inputs") or {} diff --git a/frontend/testing/unit/pages/ToolConfigDynamic.test.tsx b/frontend/testing/unit/pages/ToolConfigDynamic.test.tsx index 6cd5a1da..e4fb001d 100644 --- a/frontend/testing/unit/pages/ToolConfigDynamic.test.tsx +++ b/frontend/testing/unit/pages/ToolConfigDynamic.test.tsx @@ -108,6 +108,11 @@ describe('ToolConfig dynamic schema flow', () => { }), true, 'quick', + { + scan_profile: 'standard', + validation_mode: 'proof', + evidence_level: 'standard', + }, ) }) }) diff --git a/frontend/testing/unit/pages/ToolConfigTimeout.test.tsx b/frontend/testing/unit/pages/ToolConfigTimeout.test.tsx index 4c0b2213..513ca033 100644 --- a/frontend/testing/unit/pages/ToolConfigTimeout.test.tsx +++ b/frontend/testing/unit/pages/ToolConfigTimeout.test.tsx @@ -75,6 +75,6 @@ describe('ToolConfig timeout control', () => { // min from field.validation expect(input).toHaveAttribute('min', '30') // max is min(field.validation.max, server default_timeout) - expect(input).toHaveAttribute('max', '600') + expect(input).toHaveAttribute('max', '7200') }) }) diff --git a/frontend/testing/unit/pages/Workflows.test.tsx b/frontend/testing/unit/pages/Workflows.test.tsx index 7c304da8..25281b3d 100644 --- a/frontend/testing/unit/pages/Workflows.test.tsx +++ b/frontend/testing/unit/pages/Workflows.test.tsx @@ -130,7 +130,17 @@ describe('Workflows — create action', () => { name: 'Nightly Scan', schedule_seconds: 7200, enabled: true, - steps: [{ plugin_id: '', inputs: {} }], + steps: [ + { + plugin_id: '', + inputs: {}, + execution_context: { + scan_profile: 'standard', + validation_mode: 'proof', + evidence_level: 'standard', + }, + }, + ], }) }) })