mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
add test layout for router input/output processors
This commit is contained in:
@@ -139,11 +139,31 @@ func (m *TestDBModule) Id() string {
|
||||
return m.id
|
||||
}
|
||||
|
||||
func GetNewTestRouter() *TestRouter {
|
||||
return &TestRouter{}
|
||||
}
|
||||
|
||||
type TestRouter struct {
|
||||
}
|
||||
|
||||
func (r *TestRouter) HandleInput(ctx context.Context, sourceId string, payload any) (bool, []common.RouteIOError) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func (r *TestRouter) HandleOutput(ctx context.Context, destinationId string, payload any) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetContextWithModules(ctx context.Context, modules map[string]common.Module) context.Context {
|
||||
ctx = context.WithValue(ctx, common.ModulesContextKey, modules)
|
||||
return ctx
|
||||
}
|
||||
|
||||
func GetContextWithRouter(ctx context.Context) context.Context {
|
||||
ctx = context.WithValue(ctx, common.RouterContextKey, GetNewTestRouter())
|
||||
return ctx
|
||||
}
|
||||
|
||||
func TestProcessorBadRegistrationNoType(t *testing.T) {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
|
||||
Reference in New Issue
Block a user