test: Vitest test infrastructure + 52 unit tests for matching engine
Install vitest, @vitest/coverage-v8, jsdom, @testing-library/react/jest-dom. Add test / test:watch / test:coverage scripts to package.json. Three test suites covering the business-critical scoring pipeline: scoreCalculator.test.ts (28 tests) - calcDataQualityModifier: all 5 boundary thresholds (+5 / 0 / -5 / -10 / -15) - calcConfidenceModifier: verified/external/maison-work/future + low-conf stacking - applyHardFilters: pass, wrong asset type, area tolerance, budget exclusion, OCCUPIED penalty, excluded city - calculateScore: strong match ≥85, weak match <50, excluded=0, determinism, formula verification, DQ+confidence direction, occupied 25-point penalty, positive factors, allHardFactors completeness rankingEngine.test.ts (10 tests) - matchStrengthFromScore: STRONG/MODERATE/WEAK boundaries (78/52) - rankMatches: score sort, type tiebreak (VERIFIED > EXTERNAL), confidence tiebreak - buildFullMatch: all explainability fields, SHORTLIST+CONTACT for strong match, SCHEDULE for future signals, uncertainty indicators matchCardAdapter.test.ts (14 tests) - VERIFIED_PORTFOLIO: resultType, title, locationLabel, matchScore, scoreBreakdown, no disclaimer, reasons from positiveFactors, actions passthrough - FUTURE_AVAILABILITY: resultType, disclaimer always present, signalProbability, signalQuality HIGH for probability >= 0.70 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+10
-2
@@ -7,7 +7,10 @@
|
||||
"dev": "vite",
|
||||
"build": "tsc -b && vite build",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview"
|
||||
"preview": "vite preview",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest",
|
||||
"test:coverage": "vitest run --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
@@ -30,18 +33,23 @@
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@tailwindcss/vite": "^4.3.0",
|
||||
"@testing-library/jest-dom": "^6.9.1",
|
||||
"@testing-library/react": "^16.3.2",
|
||||
"@types/leaflet": "^1.9.21",
|
||||
"@types/node": "^24.12.3",
|
||||
"@types/react": "^19.2.14",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^6.0.1",
|
||||
"@vitest/coverage-v8": "^4.1.7",
|
||||
"eslint": "^10.3.0",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"eslint-plugin-react-refresh": "^0.5.2",
|
||||
"globals": "^17.6.0",
|
||||
"jsdom": "^29.1.1",
|
||||
"tailwindcss": "^4.3.0",
|
||||
"typescript": "~6.0.2",
|
||||
"typescript-eslint": "^8.59.2",
|
||||
"vite": "^8.0.12"
|
||||
"vite": "^8.0.12",
|
||||
"vitest": "^4.1.7"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user