summaryrefslogtreecommitdiff
path: root/internal/hexaiaction/prompts_more_test.go
blob: 62abc97a30a11e62491a5d9dbc7a166b7c71956e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package hexaiaction

import (
    "context"
    "strings"
    "testing"

    "codeberg.org/snonux/hexai/internal/llm"
)

type simpleDoer struct{ s string }

func (d simpleDoer) Chat(_ context.Context, _ []llm.Message, _ ...llm.RequestOption) (string, error) { return d.s, nil }

func TestRunOnce_StripsFences(t *testing.T) {
    got, err := runOnce(context.Background(), simpleDoer{"```\nok\n```"}, "SYS", "USER")
    if err != nil { t.Fatalf("runOnce: %v", err) }
    if strings.TrimSpace(got) != "ok" { t.Fatalf("got %q", got) }
}