Skip to content

Commit d9596b4

Browse files
committed
Fix failing utils unit test
This commit fixes a test: - fixes function names (no UUID but TxID) - a SHA256 hash is 256 long, not 36 like the old UUID was - fixes datatype in function that generates ID using custom algorithm Change-Id: I63e096c41034278be5aa8651de3b4352ee7b378c Signed-off-by: Gabor Hosszu <[email protected]>
1 parent acac0e9 commit d9596b4

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

core/util/utils_test.go

+6-9
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,16 @@ func TestGenerateHashFromSignature(t *testing.T) {
6969
}
7070
}
7171

72-
func TestGenerateUUIDfromTxSHAHash(t *testing.T) {
73-
uuid := GenerateUUIDfromTxSHAHash([]byte("foobar"))
74-
if len(uuid) != 36 {
75-
t.Fatalf("UUID length is not correct. Expected = 36, Got = %d", len(uuid))
76-
}
77-
uuid2 := GenerateUUIDfromTxSHAHash([]byte("foobar1"))
78-
if uuid == uuid2 {
79-
t.Fatalf("Two UUIDs are equal. This should never occur")
72+
func TestGeneratIDfromTxSHAHash(t *testing.T) {
73+
txid := GenerateIDfromTxSHAHash([]byte("foobar"))
74+
txid2 := GenerateIDfromTxSHAHash([]byte("foobar1"))
75+
if txid == txid2 {
76+
t.Fatalf("Two TxIDs are equal. This should never occur")
8077
}
8178
}
8279

8380
func TestGenerateIDWithAlg(t *testing.T) {
84-
_, err := GenerateIDWithAlg("sha256base64", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
81+
_, err := GenerateIDWithAlg("sha256", []byte{1, 1, 1, 1})
8582
if err != nil {
8683
t.Fatalf("Decoder failure: %v", err)
8784
}

0 commit comments

Comments
 (0)