Introduce typed D&D spell artifacts
This commit is contained in:
@@ -7,13 +7,14 @@ import (
|
||||
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/framework/pipeline"
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/modules/dnd"
|
||||
)
|
||||
|
||||
func TestNewReturnsExtractorWithMetadata(t *testing.T) {
|
||||
extractor := New()
|
||||
if extractor == nil {
|
||||
t.Fatal("New() = nil, want extractor")
|
||||
func TestNewRequiresLLMClientAndReturnsExtractor(t *testing.T) {
|
||||
if _, err := New(nil, Options{}); err == nil || !strings.Contains(err.Error(), "LLM client") {
|
||||
t.Fatalf("New(nil) error = %v, want LLM client error", err)
|
||||
}
|
||||
extractor := newExtractor(t, &fakeSpellsLLMClient{})
|
||||
if extractor.Key() != Key {
|
||||
t.Fatalf("extractor.Key() = %q, want %q", extractor.Key(), Key)
|
||||
}
|
||||
@@ -31,6 +32,7 @@ func TestModuleSpec(t *testing.T) {
|
||||
Provides: []string{
|
||||
"dnd.spell_casts",
|
||||
},
|
||||
ArtifactKind: dnd.SpellListKind,
|
||||
ReferenceSlots: []contracts.ReferenceSlot{
|
||||
{
|
||||
Name: "glossary",
|
||||
@@ -74,12 +76,11 @@ func TestRegisterMakesExtractorBuildable(t *testing.T) {
|
||||
t.Fatalf("Register() error = %v, want nil", err)
|
||||
}
|
||||
|
||||
extractor, err := registry.BuildLegacyRaw(Key)
|
||||
if err != nil {
|
||||
t.Fatalf("Build() error = %v, want nil", err)
|
||||
if _, err := registry.BuildLegacyRaw(Key); err == nil || !strings.Contains(err.Error(), "legacy raw") {
|
||||
t.Fatalf("BuildLegacyRaw() error = %v, want typed registration error", err)
|
||||
}
|
||||
if extractor.Key() != Key {
|
||||
t.Fatalf("extractor.Key() = %q, want %q", extractor.Key(), Key)
|
||||
if _, err := DecodeOptions(map[string]any{"unexpected": true}); err == nil || !strings.Contains(err.Error(), "unknown option") {
|
||||
t.Fatalf("DecodeOptions() error = %v, want unknown option error", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +102,7 @@ func TestRegisterStoresModuleSpec(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRuntimeReferenceSlotsMatchModuleSpec(t *testing.T) {
|
||||
extractor := New()
|
||||
extractor := newExtractor(t, &fakeSpellsLLMClient{})
|
||||
spec := ModuleSpec()
|
||||
|
||||
if !reflect.DeepEqual(extractor.ReferenceSlots(), spec.ReferenceSlots) {
|
||||
|
||||
Reference in New Issue
Block a user