Add Notarius reference configuration vocabulary
This commit is contained in:
@@ -170,6 +170,7 @@ func TestDescribeScriptoriumInputSource(t *testing.T) {
|
||||
{name: "prepared players input", source: "narratio.input.players", wantKind: SourceKindStableInput},
|
||||
{name: "prepared party input", source: "narratio.input.party", wantKind: SourceKindStableInput},
|
||||
{name: "prepared glossary input", source: "narratio.input.glossary", wantKind: SourceKindStableInput},
|
||||
{name: "prepared spell catalog input", source: "narratio.input.spell_catalog", wantKind: SourceKindStableInput},
|
||||
{name: "configured", source: "narratio.artifact.session_recap", wantKind: SourceKindConfiguredArtifact, wantKey: "session_recap"},
|
||||
{name: "previous", source: "narratio.previous_session.artifact.session_recap", wantKind: SourceKindPreviousArtifact, wantKey: "session_recap", wantPrev: true},
|
||||
{name: "invalid previous", source: "narratio.previous_session.artifact.", wantErr: ErrInvalidPreviousSessionSource},
|
||||
@@ -211,6 +212,43 @@ func TestDescribeScriptoriumInputSource(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDescribePreparedInputSource(t *testing.T) {
|
||||
tests := []struct {
|
||||
source string
|
||||
manifestKind string
|
||||
filename string
|
||||
}{
|
||||
{source: SourceInputPlayers, manifestKind: "players", filename: "players.yml"},
|
||||
{source: SourceInputParty, manifestKind: "party", filename: "party.yml"},
|
||||
{source: SourceInputGlossary, manifestKind: "glossary", filename: "glossary.yml"},
|
||||
{source: SourceInputSpellCatalog, manifestKind: "spell_catalog", filename: "spell_catalog.json"},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.manifestKind, func(t *testing.T) {
|
||||
descriptor, ok := DescribePreparedInputSource(" " + tt.source + " ")
|
||||
if !ok {
|
||||
t.Fatalf("DescribePreparedInputSource(%q) ok = false", tt.source)
|
||||
}
|
||||
if descriptor.SourceID != tt.source || descriptor.ManifestKind != tt.manifestKind || descriptor.Filename != tt.filename {
|
||||
t.Fatalf("DescribePreparedInputSource(%q) = %#v", tt.source, descriptor)
|
||||
}
|
||||
|
||||
scriptoriumDescriptor, err := DescribeScriptoriumInputSource(tt.source)
|
||||
if err != nil {
|
||||
t.Fatalf("DescribeScriptoriumInputSource(%q) error = %v", tt.source, err)
|
||||
}
|
||||
if scriptoriumDescriptor.PreparedInput == nil || *scriptoriumDescriptor.PreparedInput != descriptor {
|
||||
t.Fatalf("prepared input descriptor = %#v, want %#v", scriptoriumDescriptor.PreparedInput, descriptor)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if _, ok := DescribePreparedInputSource("narratio.input.unknown"); ok {
|
||||
t.Fatal("DescribePreparedInputSource(unknown) ok = true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateInputConfiguredReference(t *testing.T) {
|
||||
configured := map[string]struct{}{"session_recap": {}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user