Skip to content

Add unit tests for PromptAiModel NoPrompt scenarios - #6996

Closed
Travis Angevine (trangevi) with Copilot wants to merge 2 commits into
trangevi/autorun-improvementsfrom
copilot/sub-pr-6980
Closed

Add unit tests for PromptAiModel NoPrompt scenarios#6996
Travis Angevine (trangevi) with Copilot wants to merge 2 commits into
trangevi/autorun-improvementsfrom
copilot/sub-pr-6980

Conversation

Copilot AI commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

PromptAiModel gained NoPrompt-mode behavior (auto-select via DefaultValue, return NotFound when missing, return FailedPrecondition when no default) but had no tests covering these paths.

Changes

  • prompt_service.go: Extracted aiModelProvider interface from the concrete *ai.AiModelService field on promptService. NewPromptService signature is unchanged — *ai.AiModelService satisfies the interface implicitly.

  • prompt_service_test.go: Added mockAiModelProvider (testify mock) and three table-driven tests:

    Test Setup Expected
    NoPromptDefaultMatch DefaultValue = "gpt-4o" in model list returns model
    NoPromptDefaultMissing DefaultValue = "nonexistent" not in list codes.NotFound
    NoPromptNoDefault DefaultValue = "" codes.FailedPrecondition

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on agent init fixes for copilot/CICD scenarios Add unit tests for PromptAiModel NoPrompt scenarios Mar 4, 2026
@trangevi

Copy link
Copy Markdown
Member

Handled separately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants