Phase 1 complete: coverage from 70.1% to 85.6% (130+ tests, all passing). New test files: - lifecycle_test.go: full claim -> process -> complete integration flows - allowance_edge_test.go: boundary conditions for token/job/concurrent limits - allowance_error_test.go: mock errorStore covering all RecordUsage error paths - embed_test.go: Prompt() hit/miss and content trimming - service_test.go: DefaultServiceOptions, TaskPrompt, TaskCommit type coverage - completion_git_test.go: real git repos for AutoCommit, CreateBranch, CommitAndSync - context_git_test.go: findRelatedCode with keyword search, file limits, truncation Updated config_test.go with YAML fallback, env override, and empty-dir paths. Co-Authored-By: Charon <developers@lethean.io>
26 lines
824 B
Go
26 lines
824 B
Go
package agentic
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestPrompt_Good_CommitExists(t *testing.T) {
|
|
content := Prompt("commit")
|
|
assert.NotEmpty(t, content, "commit prompt should exist")
|
|
assert.Contains(t, content, "Commit")
|
|
}
|
|
|
|
func TestPrompt_Bad_NonexistentReturnsEmpty(t *testing.T) {
|
|
content := Prompt("nonexistent-prompt-that-does-not-exist")
|
|
assert.Empty(t, content, "nonexistent prompt should return empty string")
|
|
}
|
|
|
|
func TestPrompt_Good_ContentIsTrimmed(t *testing.T) {
|
|
content := Prompt("commit")
|
|
// Should not start or end with whitespace.
|
|
assert.Equal(t, content[0:1] != " " && content[0:1] != "\n", true, "should not start with whitespace")
|
|
lastChar := content[len(content)-1:]
|
|
assert.Equal(t, lastChar != " " && lastChar != "\n", true, "should not end with whitespace")
|
|
}
|