MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / TestLoop_MaxIterations

Function TestLoop_MaxIterations

internal/loop/loop_test.go:267–289  ·  view source on GitHub ↗

TestLoop_MaxIterations tests that the loop stops after max iterations.

(t *testing.T)

Source from the content-addressed store, hash-verified

265
266// TestLoop_MaxIterations tests that the loop stops after max iterations.
267func TestLoop_MaxIterations(t *testing.T) {
268 tmpDir := t.TempDir()
269 prdPath := createTestPRD(t, tmpDir, false) // Not complete
270
271 l := NewLoop(prdPath, "test prompt", 2, testProvider)
272
273 // Simulate reaching max iterations by manually incrementing
274 l.iteration = 2
275
276 // The Run method should check and emit MaxIterationsReached
277 // For this test, we verify the check logic
278 if l.iteration >= l.maxIter {
279 l.events <- Event{
280 Type: EventMaxIterationsReached,
281 Iteration: l.iteration,
282 }
283 }
284
285 event := <-l.events
286 if event.Type != EventMaxIterationsReached {
287 t.Errorf("Expected MaxIterationsReached event, got %v", event.Type)
288 }
289}
290
291// TestLoop_CompleteDetection tests that the loop detects completion.
292func TestLoop_CompleteDetection(t *testing.T) {

Callers

nothing calls this directly

Calls 2

createTestPRDFunction · 0.85
NewLoopFunction · 0.85

Tested by

no test coverage detected