ax(ueps): rename frame1/frame2 to frameWithSecretA/frameWithSecretB
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

Numeric suffixes (frame1, frame2) violate AX principle 1 — predictable
names over short names. Descriptive names make the test intent clear
without reading the assertions.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 09:29:58 +01:00
parent 017d386c6d
commit 02e60c2ab5
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -100,23 +100,23 @@ func TestPacket_MarshalAndSign_Good(t *testing.T) {
}
}
// frame1, _ := builder.MarshalAndSign([]byte("secret-a"))
// frame2, _ := builder.MarshalAndSign([]byte("secret-b"))
// // frame1 != frame2 (HMAC tag differs)
// frameWithSecretA, _ := builder.MarshalAndSign([]byte("secret-a"))
// frameWithSecretB, _ := builder.MarshalAndSign([]byte("secret-b"))
// // frameWithSecretA != frameWithSecretB (HMAC tag differs)
func TestPacket_MarshalAndSign_Bad(t *testing.T) {
builder := NewBuilder(0x02, []byte("data"))
frame1, err := builder.MarshalAndSign([]byte("secret-a"))
frameWithSecretA, err := builder.MarshalAndSign([]byte("secret-a"))
if err != nil {
t.Fatalf("MarshalAndSign(secret-a) failed: %v", err)
}
frame2, err := builder.MarshalAndSign([]byte("secret-b"))
frameWithSecretB, err := builder.MarshalAndSign([]byte("secret-b"))
if err != nil {
t.Fatalf("MarshalAndSign(secret-b) failed: %v", err)
}
if bytes.Equal(frame1, frame2) {
if bytes.Equal(frameWithSecretA, frameWithSecretB) {
t.Error("expected different frames for different secrets, got identical frames")
}
}