From 5db23627d6a5d6afc0bf2eca35b41175f70313aa Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Tue, 19 May 2026 21:55:43 -0500 Subject: [PATCH] add constructor for test module type --- internal/module/test/module_test.go | 6 +++--- internal/processor/test/module-output_test.go | 4 ++-- internal/test/module.go | 7 +++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/internal/module/test/module_test.go b/internal/module/test/module_test.go index 2eee6ab..c083ef1 100644 --- a/internal/module/test/module_test.go +++ b/internal/module/test/module_test.go @@ -19,7 +19,7 @@ func TestModuleBadRegistrationNoType(t *testing.T) { module.RegisterModule(module.ModuleRegistration{ Type: "", New: func(config config.ModuleConfig) (common.Module, error) { - return &test.TestModule{}, nil + return test.NewTestModule("test"), nil }, }) } @@ -47,14 +47,14 @@ func TestModuleBadRegistrationExistingType(t *testing.T) { module.RegisterModule(module.ModuleRegistration{ Type: "module.test", New: func(config config.ModuleConfig) (common.Module, error) { - return &test.TestModule{}, nil + return test.NewTestModule("test"), nil }, }) module.RegisterModule(module.ModuleRegistration{ Type: "module.test", New: func(config config.ModuleConfig) (common.Module, error) { - return &test.TestModule{}, nil + return test.NewTestModule("test"), nil }, }) } diff --git a/internal/processor/test/module-output_test.go b/internal/processor/test/module-output_test.go index e7f7b5f..8ea7ffa 100644 --- a/internal/processor/test/module-output_test.go +++ b/internal/processor/test/module-output_test.go @@ -98,7 +98,7 @@ func TestBadModuleOutput(t *testing.T) { name: "no module param", params: map[string]any{}, payload: "test", - modules: map[string]common.Module{"test": &test.TestModule{}}, + modules: map[string]common.Module{"test": test.NewTestModule("test")}, errorString: "module.output module error: not found", }, { @@ -107,7 +107,7 @@ func TestBadModuleOutput(t *testing.T) { "module": 123, }, payload: "test", - modules: map[string]common.Module{"test": &test.TestModule{}}, + modules: map[string]common.Module{"test": test.NewTestModule("test")}, errorString: "module.output module error: not a string", }, { diff --git a/internal/test/module.go b/internal/test/module.go index 27e3ac6..74a0950 100644 --- a/internal/test/module.go +++ b/internal/test/module.go @@ -8,7 +8,14 @@ import ( _ "modernc.org/sqlite" ) +func NewTestModule(id string) *TestModule { + return &TestModule{ + id: id, + } +} + type TestModule struct { + id string } func (m *TestModule) Start(ctx context.Context, router common.RouteIO) error {