31 lines
783 B
Go
31 lines
783 B
Go
package contracts_test
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestStandaloneTaskTTSMatchesCurrentContract(t *testing.T) {
|
|
load := func(path string) map[string]any {
|
|
t.Helper()
|
|
body, err := os.ReadFile(path)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var schema map[string]any
|
|
if err = json.Unmarshal(body, &schema); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
return schema
|
|
}
|
|
current := load("local/config-read.schema.json")
|
|
exported := load("schema/http-task-detail.schema.json")
|
|
expected := current["$defs"].(map[string]any)["tts"]
|
|
actual := exported["$defs"].(map[string]any)["tts"]
|
|
if !reflect.DeepEqual(expected, actual) {
|
|
t.Fatal("standalone task TTS schema has drifted from contracts/local; update the exported copy, not the runtime contract")
|
|
}
|
|
}
|