test: AuthManager malformed AUTH ignored

This commit is contained in:
Jay
2026-06-03 16:32:38 -04:00
parent b6846c25bb
commit 783171e6ef
+16 -3
View File
@@ -163,9 +163,22 @@ func TestAuthManager(t *testing.T) {
}) })
t.Run("malformed AUTH ignored", func(t *testing.T) { t.Run("malformed AUTH ignored", func(t *testing.T) {
// p.receive(envelope.EncloseAuthResponse([]byte("{}"))) — second element is object p, envoy := newMockEnvoy(t)
// Never: callback called
// assert no panic called := false
callback := func(challenge string) ([]byte, error) {
called = true
return []byte(`{"kind":22242}`), nil
}
m := NewAuthManager(envoy, callback)
t.Cleanup(m.Close)
p.connect()
// EncloseAuthResponse wraps a JSON object as the second element — not a string
p.receive([]byte(envelope.EncloseAuthResponse([]byte(`{}`))))
Never(t, func() bool { return called }, "callback should not be invoked for malformed AUTH")
}) })
t.Run("close cleans up", func(t *testing.T) { t.Run("close cleans up", func(t *testing.T) {