Preserve selected collections in materialized references
This commit is contained in:
@@ -2,11 +2,27 @@ package shared
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
|
||||
)
|
||||
|
||||
func TestValidateReferenceSelections(t *testing.T) {
|
||||
for _, slot := range []string{"party", "roster", "players", "npc_registry"} {
|
||||
references := contracts.ReferenceSet{Slots: map[string]contracts.ResolvedReferenceSlot{slot: {Items: []contracts.ReferenceItem{{Collections: []string{}}}}}}
|
||||
if err := ValidateReferenceSelections(references); err == nil || !strings.Contains(err.Error(), slot) {
|
||||
t.Fatalf("slot %s: error = %v", slot, err)
|
||||
}
|
||||
}
|
||||
for _, slot := range []string{"glossary", "spell_catalog"} {
|
||||
references := contracts.ReferenceSet{Slots: map[string]contracts.ResolvedReferenceSlot{slot: {Items: []contracts.ReferenceItem{{Collections: []string{"chosen"}}}}}}
|
||||
if err := ValidateReferenceSelections(references); err != nil {
|
||||
t.Fatalf("slot %s: %v", slot, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestReferenceMediaTypesReturnsDefensiveCopy(t *testing.T) {
|
||||
want := []string{
|
||||
"application/json",
|
||||
|
||||
Reference in New Issue
Block a user