Test upkeep. Currently 76.9%
This commit is contained in:
parent
aa66a67dd6
commit
b9e52c98c5
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"crypto/ed25519"
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
@ -58,3 +59,45 @@ func TestB32Encode(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestEncodePeerMhash(t *testing.T) {
|
||||
pub := ed25519.PublicKey{
|
||||
0x1c,
|
||||
0xff,
|
||||
0xcf,
|
||||
0x5d,
|
||||
0xd4,
|
||||
0xa2,
|
||||
0x1d,
|
||||
0x26,
|
||||
0xef,
|
||||
0xab,
|
||||
0x55,
|
||||
0xdd,
|
||||
0x86,
|
||||
0x46,
|
||||
0xcd,
|
||||
0x1d,
|
||||
0x93,
|
||||
0x46,
|
||||
0x27,
|
||||
0x18,
|
||||
0xfd,
|
||||
0x85,
|
||||
0xb4,
|
||||
0xe8,
|
||||
0xb7,
|
||||
0x21,
|
||||
0x71,
|
||||
0x5c,
|
||||
0xfe,
|
||||
0x36,
|
||||
0xdb,
|
||||
0xa8,
|
||||
}
|
||||
results := encodePeerMhash(pub)
|
||||
expected := "USER.3KZWYQEMM8EJDVXBAQERCHPD3P9MC9RRZP2V9T5Q45RNSZHPVEM0"
|
||||
if results != expected {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMessageExists(t *testing.T) {
|
||||
resetDB()
|
||||
message := "TEXT.49S2F3Y6AXHDD8F62RKXPFWC2BYBV5D16VQY34F40NTQFZW1R0G0"
|
||||
ok := messageExists(message)
|
||||
if ok {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
|
@ -46,3 +46,13 @@ func TestSetPeerStatus(t *testing.T) {
|
|||
setPeerStatus(mHash, following)
|
||||
setPeerStatus(mHash, blocked)
|
||||
}
|
||||
|
||||
func TestRemovePeer(t *testing.T) {
|
||||
resetDB()
|
||||
mHash := "USER.GM84FEYKRQ1QFCZY68YDCRPG8HKXQPQCQSMDQKGTGX8ZY8KFSFJR"
|
||||
setPeerStatus(mHash, following)
|
||||
removePeer(mHash)
|
||||
if getPeerStatus(mHash) != unknown {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue