Skip to content

test : add unit tests for cv-prompts.ts #2878

Description

@tmdeveloper007

Summary of What Needs to be Done:
Add unit tests for the four exported prompt-building functions in src/lib/cv/cv-prompts.ts: cvBulletPointPrompt, cvProjectDescriptionPrompt, cvProfessionalSummaryPrompt, and cvSkillSummaryPrompt. These are pure functions that build AI prompt strings from ContributionClassification and TargetRole inputs.

Changes that Need to be Made:

  • Create test/cv-prompts.test.ts
  • Write tests for cvBulletPointPrompt: verify output is non-empty string, contains role, contains honesty clause, contains repository data when repos are present, falls back gracefully when repos array is empty
  • Write tests for cvProjectDescriptionPrompt: verify output contains role, repos, JSON format instruction
  • Write tests for cvProfessionalSummaryPrompt: verify output contains role, primary domain, and contribution metrics
  • Write tests for cvSkillSummaryPrompt: verify output contains role, tech stack data, and JSON format instruction
  • All tests should use realistic mock data derived from @/types/cv-types

Impact that it would Provide:
These tests validate that the prompt generation logic correctly serialises contribution data and enforces the honesty constraints for the AI CV generator. This prevents malformed prompts from being sent to the Groq API, reducing hallucination risk.

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