mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 12:55:29 +00:00
test a couple error router scenarios
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user