Skip to content

Add unit tests for buildUserPrompt #150

Description

@404-Page-Found

Description

The buildUserPrompt function in src/llm/prompt.ts has no direct unit tests. It takes a diff string and returns a formatted user prompt containing the diff in a fenced code block with instructions.

Proposed Solution

Add tests that verify:

  • The output includes the literal diff text
  • The output includes the 'Generate 3 commit message suggestions' instruction
  • The output wraps the diff in triple-backtick fencing
  • An empty diff is handled correctly

Why It is a Good First Issue

This is a tiny pure function with a clear contract. The test infrastructure and import patterns are well-established (see tests/build-system-prompt.test.mjs which already tests buildSystemPrompt). Adding a few assertion lines is straightforward.

Files

  • src/llm/prompt.ts (lines 60-62)
  • tests/build-system-prompt.test.mjs (reference for patterns)

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions