switch modules to accept an InputHandler instead of the full router

This commit is contained in:
Joel Wetzell
2026-05-20 21:03:41 -05:00
parent be0b1c4a5f
commit 4cedd58a76
31 changed files with 301 additions and 297 deletions
+8 -4
View File
@@ -52,8 +52,9 @@ func TestGoodRouteHandleInput(t *testing.T) {
}
inputData := "test input data"
testRouter := test.GetNewTestRouter()
payload, err := testRoute.ProcessPayload(t.Context(), common.WrappedPayload{
Router: &MockRouter{},
InputHandler: testRouter.HandleInput,
Modules: map[string]common.Module{"output": &test.TestOutputModule{}},
Payload: inputData,
})
@@ -91,8 +92,9 @@ func TestRouteHandleInputWithProcessorError(t *testing.T) {
}
inputData := "test input data"
testRouter := test.GetNewTestRouter()
_, err = testRoute.ProcessPayload(t.Context(), common.WrappedPayload{
Router: &MockRouter{},
InputHandler: testRouter.HandleInput,
Modules: map[string]common.Module{"output": &test.TestOutputModule{}},
Payload: inputData,
})
@@ -120,8 +122,9 @@ func TestRouteHandleNilPayload(t *testing.T) {
return
}
testRouter := test.GetNewTestRouter()
payload, err := testRoute.ProcessPayload(t.Context(), common.WrappedPayload{
Router: &MockRouter{},
InputHandler: testRouter.HandleInput,
Modules: map[string]common.Module{"output": &test.TestOutputModule{}},
Payload: nil,
})
@@ -152,8 +155,9 @@ func TestRouteHandleNilPayloadFromProcessor(t *testing.T) {
t.Fatalf("route failed to create: %v", err)
}
testRouter := test.GetNewTestRouter()
_, err = testRoute.ProcessPayload(t.Context(), common.WrappedPayload{
Router: &MockRouter{},
InputHandler: testRouter.HandleInput,
Modules: map[string]common.Module{"output": &test.TestOutputModule{}},
Payload: "test",
})