test error cleanup

This commit is contained in:
Joel Wetzell
2025-12-24 19:45:24 -06:00
parent 6611821155
commit ccff105e37
13 changed files with 65 additions and 74 deletions

View File

@@ -15,15 +15,14 @@ func TestRouteCreate(t *testing.T) {
testRoute, err := route.NewRoute(routeConfig)
if err != nil {
t.Errorf("Failed to create route: %v", err)
return
t.Fatalf("route failed to create: %v", err)
}
if testRoute.Input() != routeConfig.Input {
t.Errorf("route input does not match expected input")
t.Fatalf("route input does not match expected input")
}
if testRoute.Output() != routeConfig.Output {
t.Errorf("route output does not match expected output")
t.Fatalf("route output does not match expected output")
}
}
@@ -48,14 +47,13 @@ func TestGoodRouteHandleInput(t *testing.T) {
testRoute, err := route.NewRoute(routeConfig)
if err != nil {
t.Errorf("Failed to create route: %v", err)
return
t.Fatalf("route failed to create: %v", err)
}
inputData := "test input data"
err = testRoute.HandleInput(t.Context(), "input", inputData, &MockRouter{})
if err != nil {
t.Errorf("Route HandleOutput returned error: %v", err)
t.Fatalf("route HandleOutput returned error: %v", err)
}
}
@@ -70,14 +68,13 @@ func TestRouteHandleInputWithProcessorError(t *testing.T) {
testRoute, err := route.NewRoute(routeConfig)
if err != nil {
t.Errorf("Failed to create route: %v", err)
return
t.Fatalf("route failed to create: %v", err)
}
inputData := "test input data"
err = testRoute.HandleInput(t.Context(), "input", inputData, &MockRouter{})
if err == nil {
t.Errorf("Route HandleOutput did not return error for bad processor")
t.Fatalf("route HandleOutput did not return error for bad processor")
}
}
@@ -90,13 +87,13 @@ func TestRouteHandleNilPayload(t *testing.T) {
testRoute, err := route.NewRoute(routeConfig)
if err != nil {
t.Errorf("Failed to create route: %v", err)
t.Fatalf("route failed to create: %v", err)
return
}
err = testRoute.HandleInput(t.Context(), "input", nil, &MockRouter{})
if err != nil {
t.Errorf("Route HandleOutput returned error for nil payload: %v", err)
t.Fatalf("route HandleOutput returned error for nil payload: %v", err)
}
}
@@ -111,13 +108,12 @@ func TestRouteHandleNilPayloadFromProcessor(t *testing.T) {
testRoute, err := route.NewRoute(routeConfig)
if err != nil {
t.Errorf("Failed to create route: %v", err)
return
t.Fatalf("route failed to create: %v", err)
}
err = testRoute.HandleInput(t.Context(), "input", nil, &MockRouter{})
if err != nil {
t.Errorf("Route HandleOutput returned error for nil payload: %v", err)
t.Fatalf("route HandleOutput returned error for nil payload: %v", err)
}
}
@@ -132,8 +128,7 @@ func TestRouteUnknownProcessor(t *testing.T) {
_, err := route.NewRoute(routeConfig)
if err == nil {
t.Errorf("Expected error when creating route with unknown processor, got nil")
return
t.Fatalf("route error expected when creating route with an unknown processor, got nil")
}
}
@@ -148,7 +143,6 @@ func TestRouteBadProcessorConfig(t *testing.T) {
_, err := route.NewRoute(routeConfig)
if err == nil {
t.Errorf("Expected error when creating route with bad processor, got nil")
return
t.Fatalf("route error expected creating route with bad processor, got nil")
}
}