fix(test): update tests for event bus + room-based Hub signatures

- integration_test: pass events.Bus to NewRouter
- handler_test: pass events.Bus to handler.New
- hub_test: add mock MembershipChecker, JWT token generation,
  replace hub.clients with totalClients() helper for room-based Hub

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Naiyuan Qing 2026-03-25 16:49:45 +08:00
parent 06122dfe9e
commit fc3dc39b82
3 changed files with 50 additions and 17 deletions

View file

@ -13,6 +13,7 @@ import (
"github.com/go-chi/chi/v5"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/multica-ai/multica/server/internal/events"
"github.com/multica-ai/multica/server/internal/realtime"
db "github.com/multica-ai/multica/server/pkg/db/generated"
)
@ -44,7 +45,8 @@ func TestMain(m *testing.M) {
queries := db.New(pool)
hub := realtime.NewHub()
go hub.Run()
testHandler = New(queries, pool, hub)
bus := events.NewBus()
testHandler = New(queries, pool, hub, bus)
testPool = pool
testUserID, testWorkspaceID, err = setupHandlerTestFixture(ctx, pool)