aboutsummaryrefslogtreecommitdiff
path: root/message/message_test.go
diff options
context:
space:
mode:
authorJoop Kiefte <ikojba@gmail.com>2021-12-12 02:44:11 +0000
committerGitHub <noreply@github.com>2021-12-12 02:44:11 +0000
commit407a75942f8bb7758f40bb04714d2ff0964972e1 (patch)
tree18f671d672e4eecd00ad650fe6701bc44ef9eeff /message/message_test.go
parent7f41a498b057d2ab180d288f212e0adc498e203d (diff)
Implemented paging and improved POW calculation
Diffstat (limited to 'message/message_test.go')
-rw-r--r--message/message_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/message/message_test.go b/message/message_test.go
index 06f1bc7..be2b233 100644
--- a/message/message_test.go
+++ b/message/message_test.go
@@ -8,11 +8,11 @@ import (
"git.kiefte.eu/lapingvino/infodump/message"
)
-// Test if the code finishes in time
+// Test if creating a proof of work of 16 leading zeros finishes in 10 seconds
func TestMessageTimeout(t *testing.T) {
- time.AfterFunc(10*time.Second, func() {
- t.Error("Test timed out")
- })
- _ = message.New("Hello World!", 16, time.Now().Unix())
- // Success
+ msg := message.Message{Message: "test", Timestamp: time.Now().Unix()}
+ err := msg.ProofOfWork(16, 10*time.Second)
+ if err != nil {
+ t.Error(err)
+ }
}