From fca6ea5c1ddd7192b7605352f89dd94c5b102c8f Mon Sep 17 00:00:00 2001 From: ayn2op Date: Sun, 4 Oct 2026 23:55:16 -0400 Subject: [PATCH] test(qr): wait for the client to close after the gateway cancels --- internal/ui/login/qr/conn_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/ui/login/qr/conn_test.go b/internal/ui/login/qr/conn_test.go index 3bd9d2e..f10b6a0 100644 --- a/internal/ui/login/qr/conn_test.go +++ b/internal/ui/login/qr/conn_test.go @@ -67,6 +67,10 @@ func serveGateway(t *testing.T, acks int) http.HandlerFunc { } if shown && acks <= 0 { _ = conn.WriteJSON(map[string]any{"op": "cancel"}) + // Closing first would fail the client's next heartbeat before it reads the cancel. + for err == nil { + _, _, err = conn.ReadMessage() + } return } }