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{