package app

import (
	"net/http"
	"net/http/httptest"
	"testing"

	amcsllm "git.warky.dev/wdevs/amcs/llm"
)

func TestServeLLMInstructions(t *testing.T) {
	req := httptest.NewRequest(http.MethodGet, "/llm", nil)
	rec := httptest.NewRecorder()

	serveLLMInstructions(rec, req)

	res := rec.Result()
	defer func() {
		_ = res.Body.Close()
	}()

	if res.StatusCode != http.StatusOK {
		t.Fatalf("status = %d, want %d", res.StatusCode, http.StatusOK)
	}
	if got := res.Header.Get("Content-Type"); got != "text/markdown; charset=utf-8" {
		t.Fatalf("content-type = %q, want %q", got, "text/markdown; charset=utf-8")
	}
	if body := rec.Body.String(); body != string(amcsllm.MemoryInstructions) {
		t.Fatalf("body = %q, want embedded instructions", body)
	}
}
