fix(test): add sleep after WS connect for Hub register timing

The Hub processes client registration asynchronously via a channel.
Without a short delay, the issue creation can fire before the client
is added to the workspace room, so the broadcast has no recipients.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Naiyuan Qing 2026-03-25 17:15:23 +08:00
parent 77141cf0a7
commit 0a5dd068b1

View file

@ -717,6 +717,9 @@ func TestWebSocketIntegration(t *testing.T) {
}
defer conn.Close()
// Allow Hub goroutine to process the register and add client to room
time.Sleep(100 * time.Millisecond)
// Create an issue — this should trigger a WebSocket broadcast
resp := authRequest(t, "POST", "/api/issues?workspace_id="+testWorkspaceID, map[string]any{
"title": "WebSocket test issue",