Move location registry modules to canonical namespace
This commit is contained in:
25
internal/modules/dnd/extract/locationregistry/schema_test.go
Normal file
25
internal/modules/dnd/extract/locationregistry/schema_test.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package locationregistry
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLocationResponseSchemaIsPrivateAndStructural(t *testing.T) {
|
||||
schema, err := loadResponseSchema()
|
||||
if err != nil {
|
||||
t.Fatalf("loadResponseSchema() error = %v", err)
|
||||
}
|
||||
if schema.Key != ResponseSchemaKey || schema.ID != ResponseSchemaID || schema.Name != ResponseSchemaName || schema.Version != SchemaVersion || !strings.HasPrefix(schema.SHA256, "sha256:") || !json.Valid(schema.JSONSchema) {
|
||||
t.Fatalf("schema = %#v, want location response schema", schema)
|
||||
}
|
||||
var document map[string]any
|
||||
if err := json.Unmarshal(schema.JSONSchema, &document); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
encoded, err := json.Marshal(document)
|
||||
if err != nil || strings.Contains(string(encoded), `"id"`) {
|
||||
t.Fatalf("schema = %s, want no durable ID field", encoded)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user