Skip to content

test : add unit tests for cv-classifier.ts #2879

Description

@tmdeveloper007

Summary of What Needs to be Done:
Add unit tests for the pure classification functions exported from src/lib/cv/cv-classifier.ts. The module is explicitly documented as containing only pure functions with no network calls or database access.

Changes that Need to be Made:

  • Create test/cv-classifier.test.ts
  • Write tests for detectTechnologies: verify it correctly categorises languages, frameworks, and tools; handles empty repo arrays; deduplicates by name; sums occurrences
  • Write tests for detectDomains: verify Frontend/Backend/AI_ML/DevOps/etc. domains are scored based on technology and keyword signals
  • Write tests for classifyRepository: verify it returns RepositoryAnalysis with correct fields for a mock RepositoryData input
  • Write tests for calculateContributionScores: verify totalPRsMerged, totalCommits, topLanguages are computed correctly
  • Write tests for the module-level constants DOMAIN_TECH_MAP and DOMAIN_KEYWORD_MAP are non-empty and well-structured
  • All tests use @/types/cv-types types and realistic mock data

Impact that it would Provide:
The cv-classifier module is the core of the AI-powered CV generator. Comprehensive tests ensure that technology detection and domain classification remain correct as the contribution data model evolves, preventing incorrect resume content.

Hello @Priyanshu-byte-coder, please assign this issue to me (@tmdeveloper007) so I can open a focused PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions