ax(node): fix TestProtocol_ValidateResponse_Ugly comment and assertion
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

ValidateResponse wraps type-mismatch in *ProtocolError (correct behaviour).
The docstring example showed the wrong negation and the assertion fired on
every run. Both the comment (AX §2 — comments as accurate usage examples)
and the guard were inverted; corrected to !IsProtocolError.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 16:56:38 +01:00
parent 1e5af44364
commit 09f6f12f08
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -48,7 +48,7 @@ func TestProtocol_ValidateResponse_Bad(t *testing.T) {
//
// msg, _ := NewMessage(MsgPong, "sender", "receiver", nil)
// err := handler.ValidateResponse(msg, MsgStats)
// if IsProtocolError(err) { t.Error("type mismatch is not a ProtocolError") }
// if !IsProtocolError(err) { t.Error("type mismatch must be a ProtocolError") }
func TestProtocol_ValidateResponse_Ugly(t *testing.T) {
handler := &ResponseHandler{}
@ -57,8 +57,8 @@ func TestProtocol_ValidateResponse_Ugly(t *testing.T) {
if err == nil {
t.Error("expected error for wrong type")
}
if IsProtocolError(err) {
t.Error("type mismatch should not produce a ProtocolError")
if !IsProtocolError(err) {
t.Error("type mismatch must produce a ProtocolError")
}
}