Cleanup pass to remove refactoring-related artifacts and references
This commit is contained in:
@@ -3,6 +3,7 @@ package modules
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/contracts"
|
||||
@@ -64,22 +65,17 @@ func TestUnsupportedUnknownModuleKeyFailsCleanly(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRecognizedButUnimplementedModuleKeyFailsCleanly(t *testing.T) {
|
||||
func TestRecognizedButMissingConstructorFailsWithInternalRegistryError(t *testing.T) {
|
||||
factory := NewFactory(Dependencies{})
|
||||
// Force an unimplemented state for a known key to keep reason-code behavior tested.
|
||||
// Force a missing constructor state for a known key.
|
||||
factory.constructors[ModuleKeySpokenWord] = nil
|
||||
|
||||
_, err := factory.ModuleForSpec(contracts.ModuleRunSpec{ModuleKey: ModuleKeySpokenWord, InstanceName: ModuleKeySpokenWord})
|
||||
if err == nil {
|
||||
t.Fatal("expected unimplemented-module error")
|
||||
t.Fatal("expected constructor-missing error")
|
||||
}
|
||||
|
||||
var unimplemented *UnimplementedModuleError
|
||||
if !errors.As(err, &unimplemented) {
|
||||
t.Fatalf("expected UnimplementedModuleError, got %T (%v)", err, err)
|
||||
}
|
||||
if unimplemented.ReasonCode() != ReasonUnimplementedModule {
|
||||
t.Fatalf("unexpected reason code: %q", unimplemented.ReasonCode())
|
||||
if !strings.Contains(err.Error(), "internal module registry error") {
|
||||
t.Fatalf("expected internal registry error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user