From 8f936769342382e78609d210b65243eaa7b56731 Mon Sep 17 00:00:00 2001 From: waleedcodes <110061477+waleedcodes@users.noreply.github.com> Date: Fri, 9 Oct 2026 21:25:46 +0500 Subject: [PATCH 1/3] test(tree): scaffold tree data provider test suite --- tests/treeDataProvider.test.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/treeDataProvider.test.ts diff --git a/tests/treeDataProvider.test.ts b/tests/treeDataProvider.test.ts new file mode 100644 index 0000000..7ee7ea9 --- /dev/null +++ b/tests/treeDataProvider.test.ts @@ -0,0 +1,23 @@ +import { describe, expect, it } from 'vitest'; +import { VerificationReport } from '../src/types'; +import { ProofCodeTreeDataProvider } from '../src/ui/treeDataProvider'; + +describe('ProofCodeTreeDataProvider', () => { + it('should show run message when no report is set', async () => { + const provider = new ProofCodeTreeDataProvider(); + const children = await provider.getChildren(); + expect(children).toHaveLength(1); + expect(children[0].label).toContain('Run "ProofCode: Verify Current Changes"'); + }); + + it('should render root categories when a report is loaded', async () => { + const provider = new ProofCodeTreeDataProvider(); + const mockReport: VerificationReport = { + timestamp: new Date().toISOString(), + repoRoot: '/workspace', + branch: 'working', + score: { total: 85, deductions: [] }, + verdict: 'READY_TO_SHIP', + summary: { + filesChanged: 3, + linesAdded: 50, From 3e132828beb2f425601bfdd9947e21811c7e752e Mon Sep 17 00:00:00 2001 From: waleedcodes <110061477+waleedcodes@users.noreply.github.com> Date: Fri, 9 Oct 2026 21:25:46 +0500 Subject: [PATCH 2/3] test(tree): test empty state prompt and report set handling --- tests/treeDataProvider.test.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/treeDataProvider.test.ts b/tests/treeDataProvider.test.ts index 7ee7ea9..c3e0af0 100644 --- a/tests/treeDataProvider.test.ts +++ b/tests/treeDataProvider.test.ts @@ -21,3 +21,30 @@ describe('ProofCodeTreeDataProvider', () => { summary: { filesChanged: 3, linesAdded: 50, + linesDeleted: 10, + symbolsAffected: 4, + apiRoutesAffected: 1, + testsAdded: 1, + testsAffected: 1, + highRiskCount: 0, + mediumRiskCount: 0, + lowRiskCount: 0 + }, + impact: { + changedFiles: ['/workspace/src/app.ts'], + changedSymbols: [], + affectedFiles: [], + affectedCallers: [], + affectedRoutes: [], + totalCallersCount: 0, + untestedCallersCount: 0 + }, + risks: [], + rules: [], + checks: { + typescript: { name: 'TypeScript', status: 'PASS' }, + eslint: { name: 'ESLint', status: 'PASS' }, + unitTests: { name: 'Unit Tests', status: 'PASS' }, + build: { name: 'Build', status: 'PASS' } + } + }; From 1c8c1a00e9308b6bb2bed1c322bcb6517ad2081c Mon Sep 17 00:00:00 2001 From: waleedcodes <110061477+waleedcodes@users.noreply.github.com> Date: Fri, 9 Oct 2026 21:25:46 +0500 Subject: [PATCH 3/3] test(tree): test root nodes and child element resolution --- tests/treeDataProvider.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/treeDataProvider.test.ts b/tests/treeDataProvider.test.ts index c3e0af0..9273ee0 100644 --- a/tests/treeDataProvider.test.ts +++ b/tests/treeDataProvider.test.ts @@ -48,3 +48,20 @@ describe('ProofCodeTreeDataProvider', () => { build: { name: 'Build', status: 'PASS' } } }; + + provider.setReport(mockReport); + const roots = await provider.getChildren(); + expect(roots).toHaveLength(6); + expect(roots[0].label).toContain('Verification Score: 85%'); + expect(roots[1].label).toContain('Changed Files (3)'); + expect(roots[2].label).toContain('Impact'); + expect(roots[3].label).toContain('Risks & Evidence (0)'); + expect(roots[4].label).toContain('Project Rules'); + expect(roots[5].label).toContain('Checks & Tests'); + + // Get children of Changed Files + const fileChildren = await provider.getChildren(roots[1]); + expect(fileChildren).toHaveLength(1); + expect(fileChildren[0].label).toBe('app.ts'); + }); +});