Coverage: agentic 40.1% → 54.3%, setup 71.5% → 75.8% Total: 695 passing tests across all packages (was ~357) New test files (15): - commands_forge_test.go — parseForgeArgs, fmtIndex - commands_workspace_test.go — extractField (9 cases) - commands_test.go — command registration + Core integration - handlers_test.go — RegisterHandlers, IPC pipeline, lifecycle - plan_crud_test.go — full CRUD via MCP handlers (23 tests) - prep_extra_test.go — buildPrompt, findConsumersList, pullWikiContent, getIssueBody - queue_extra_test.go — ConcurrencyLimit YAML, delayForAgent, drainOne - remote_client_test.go — mcpInitialize, mcpCall, readSSEData, setHeaders - remote_test.go — resolveHost, remoteToken - resume_test.go — resume dry run, agent override, validation - review_queue_test.go — countFindings, parseRetryAfter, buildAutoPRBody - review_queue_extra_test.go — buildReviewCommand, rateLimitState, reviewQueue - verify_extra_test.go — attemptVerifyAndMerge, autoVerifyAndMerge pipeline - watch_test.go — findActiveWorkspaces, resolveWorkspaceDir - setup/setup_extra_test.go — defaultBuildCommand, defaultTestCommand all branches Co-Authored-By: Virgil <virgil@lethean.io>
52 lines
1.3 KiB
Go
52 lines
1.3 KiB
Go
// SPDX-License-Identifier: EUPL-1.2
|
|
|
|
package agentic
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
// --- countFindings (extended beyond paths_test.go) ---
|
|
|
|
func TestCountFindings_Good_BulletFindings(t *testing.T) {
|
|
output := `Review:
|
|
- Missing error check in handler.go:42
|
|
- Unused import in config.go
|
|
* Race condition in worker pool`
|
|
assert.Equal(t, 3, countFindings(output))
|
|
}
|
|
|
|
func TestCountFindings_Good_IssueKeyword(t *testing.T) {
|
|
output := `Line 10: Issue: variable shadowing
|
|
Line 25: Finding: unchecked return value`
|
|
assert.Equal(t, 2, countFindings(output))
|
|
}
|
|
|
|
func TestCountFindings_Good_DefaultOneIfNotClean(t *testing.T) {
|
|
output := "Some output without markers but also not explicitly clean"
|
|
assert.Equal(t, 1, countFindings(output))
|
|
}
|
|
|
|
func TestCountFindings_Good_MixedContent(t *testing.T) {
|
|
output := `Summary of review:
|
|
The code is generally well structured.
|
|
- Missing nil check
|
|
Some commentary here
|
|
* Redundant allocation`
|
|
assert.Equal(t, 2, countFindings(output))
|
|
}
|
|
|
|
// --- parseRetryAfter (extended) ---
|
|
|
|
func TestParseRetryAfter_Good_SingleMinuteAndSeconds(t *testing.T) {
|
|
d := parseRetryAfter("try after 1 minute and 30 seconds")
|
|
assert.Equal(t, 1*time.Minute+30*time.Second, d)
|
|
}
|
|
|
|
func TestParseRetryAfter_Bad_EmptyMessage(t *testing.T) {
|
|
d := parseRetryAfter("")
|
|
assert.Equal(t, 5*time.Minute, d)
|
|
}
|