summaryrefslogtreecommitdiff
path: root/internal/hexaiaction/prompts_more_test.go
blob: 9f5d6cba2faf0d9193665c6bb15b1924e9c42572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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 (d simpleDoer) DefaultModel() string { return "m" }

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)
	}
}