From bd2a68ff6ec107e7d54f0b52b9f96fc4f1502ab7 Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Sun, 28 Dec 2025 18:17:23 -0600 Subject: [PATCH] test a couple error router scenarios --- router_test.go | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/router_test.go b/router_test.go index eba551e..ecca63d 100644 --- a/router_test.go +++ b/router_test.go @@ -60,6 +60,7 @@ func TestNewRouter(t *testing.T) { routerConfig := config.Config{ Modules: []config.ModuleConfig{ { + Id: "mock", Type: "mock.counter", }, }, @@ -76,6 +77,44 @@ func TestNewRouter(t *testing.T) { } } +func TestNewRouterUnknownModuleType(t *testing.T) { + routerConfig := config.Config{ + Modules: []config.ModuleConfig{ + { + Id: "mock", + Type: "asd.fjlkj23oiu4ksldj", + }, + }, + } + + _, moduleErrors, _ := showbridge.NewRouter(t.Context(), routerConfig) + + if moduleErrors == nil { + t.Fatalf("router should have returned 'unknown module' module errors") + } +} + +func TestNewRouterDuplicateModuleId(t *testing.T) { + routerConfig := config.Config{ + Modules: []config.ModuleConfig{ + { + Id: "mock", + Type: "mock.counter", + }, + { + Id: "mock", + Type: "mock.counter", + }, + }, + } + + _, moduleErrors, _ := showbridge.NewRouter(t.Context(), routerConfig) + + if moduleErrors == nil { + t.Fatalf("router should have returned 'duplicate id' module error") + } +} + func TestRouterInputSingleRoute(t *testing.T) { routerConfig := config.Config{ Modules: []config.ModuleConfig{