Skip to content

Commit

Permalink
cover all actions with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
illia-malachyn committed Dec 11, 2024
1 parent 665cdb0 commit b62f8db
Show file tree
Hide file tree
Showing 2 changed files with 405 additions and 24 deletions.
7 changes: 6 additions & 1 deletion engine/access/rest/websockets/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import (
"github.com/onflow/flow-go/utils/concurrentmap"
)

var (
ErrUnmarshalMessage = errors.New("failed to unmarshal message")
)

type Controller struct {
logger zerolog.Logger
config Config
Expand Down Expand Up @@ -260,7 +264,7 @@ func (c *Controller) handleUnsubscribe(ctx context.Context, msg models.Unsubscri

provider, ok := c.dataProviders.Get(id)
if !ok {
c.writeBaseErrorResponse(ctx, err, "unsubscribe")
c.writeBaseErrorResponse(ctx, fmt.Errorf("could not find data provider with such id"), "unsubscribe")
c.logger.Debug().Err(err).Msg("no active subscription with such ID found")
return
}
Expand Down Expand Up @@ -295,6 +299,7 @@ func (c *Controller) handleListSubscriptions(ctx context.Context) {
resp := models.ListSubscriptionsMessageResponse{
BaseMessageResponse: models.BaseMessageResponse{
Success: true,
Action: "list_subscriptions",
},
Subscriptions: subs,
}
Expand Down
Loading

0 comments on commit b62f8db

Please sign in to comment.