Initial commit on Forgejo
Fresh repository history for elektrine/tarakan-client hosted at https://git.elektrine.com/elektrine/tarakan-client.
This commit is contained in:
commit
58b29a7f84
70 changed files with 12994 additions and 0 deletions
53
internal/app/work_progress_test.go
Normal file
53
internal/app/work_progress_test.go
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
package app
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/atomine-elektrine/tarakan-client/internal/agent"
|
||||
repoctx "github.com/atomine-elektrine/tarakan-client/internal/context"
|
||||
"github.com/atomine-elektrine/tarakan-client/internal/session"
|
||||
)
|
||||
|
||||
func TestIsAgentStreamLine(t *testing.T) {
|
||||
if !isAgentStreamLine("Grok Build: thinking…") {
|
||||
t.Fatal("expected agent stream line")
|
||||
}
|
||||
if isAgentStreamLine("Cloning max/elektrine from http://localhost:4000…") {
|
||||
t.Fatal("pipeline step should not be agent stream")
|
||||
}
|
||||
if isAgentStreamLine("Claiming job #12…") {
|
||||
t.Fatal("claim step should not be agent stream")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleWorkEventAppendsSystemProgress(t *testing.T) {
|
||||
m := New(repoctx.Info{Root: t.TempDir(), Name: "demo"}, agent.Registry{}, agent.Provider{Name: "grok", Description: "Grok Build"})
|
||||
m.busy = true
|
||||
ch := make(chan workEvent)
|
||||
m.workEvents = ch
|
||||
|
||||
line := "Fetching job #1…"
|
||||
next, cmd := m.handleWorkEvent(workEventMsg{event: workEvent{line: line}})
|
||||
m = next.(Model)
|
||||
if m.busyStatus != line {
|
||||
t.Fatalf("busyStatus = %q", m.busyStatus)
|
||||
}
|
||||
found := false
|
||||
for _, message := range m.transcript.Messages() {
|
||||
if message.Role == session.RoleSystem && message.Content == line {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Fatal("expected system transcript line")
|
||||
}
|
||||
if cmd == nil {
|
||||
t.Fatal("expected continue listen cmd")
|
||||
}
|
||||
|
||||
next, _ = m.handleWorkEvent(workEventMsg{event: workEvent{finished: true, final: noticeMsg{body: "ok"}}})
|
||||
m = next.(Model)
|
||||
if m.busy {
|
||||
t.Fatal("expected idle after final")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue