46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package ai
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.ipao.vip/rogee/go-sip/contracts"
|
|
)
|
|
|
|
func TestValidateUsesPinnedAIContract(t *testing.T) {
|
|
raw, err := contracts.Read("examples/agent-version.json")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
snapshot, err := ValidateForMode(raw, ModeFullAI)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if snapshot.AgentVersionID == "" || snapshot.Digest == "" || snapshot.Mode != ModeFullAI {
|
|
t.Fatalf("snapshot = %+v", snapshot)
|
|
}
|
|
}
|
|
|
|
func TestValidateASROnlySnapshot(t *testing.T) {
|
|
raw, err := contracts.Read("examples/agent-version-asr-only.json")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
snapshot, err := ValidateForMode(raw, ModeASROnly)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if snapshot.AgentVersionID == "" || snapshot.Digest == "" || snapshot.Mode != ModeASROnly {
|
|
t.Fatalf("snapshot = %+v", snapshot)
|
|
}
|
|
}
|
|
|
|
func TestASROnlyRejectsFullAIFields(t *testing.T) {
|
|
raw, err := contracts.Read("examples/invalid-asr-only-with-llm.json")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if _, err := ValidateForMode(raw, ModeASROnly); err == nil {
|
|
t.Fatal("expected ASR-only schema rejection")
|
|
}
|
|
}
|