* Implement tests for error functions like errRequiredField, errInvalidField, and errEntityNotFound. * Ensure proper metadata is returned for various error scenarios. * Validate error handling in CRM, Files, and other tools. * Introduce tests for parsing stored file IDs and UUIDs. * Enhance coverage for helper functions related to project resolution and session management.
32 lines
754 B
Go
32 lines
754 B
Go
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)
|
|
}
|
|
}
|