-
Notifications
You must be signed in to change notification settings - Fork 1
/
whisper_helper_test.go
36 lines (32 loc) · 1.27 KB
/
whisper_helper_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("WhisperHelper", func() {
whisperHelper := &WhisperHelper{}
Describe("SendAsymMsg", func() {
It("should return error when pass an empty sender key", func() {
err := whisperHelper.SendAsymMsg(&Message{})
Expect(err.Error()).To(Equal("sender key is empty"))
})
It("should return error when pass an invalid hex key", func() {
err := whisperHelper.SendAsymMsg(&Message{From: "nonHex"})
Expect(err.Error()).To(Equal("invalid sender key"))
})
It("should return error when pass an empty recipient key", func() {
err := whisperHelper.SendAsymMsg(&Message{From: "46342e3c48021fc8e6d5a704ba84c56945037ef151ba38b21663767c0abb3c63"})
Expect(err.Error()).To(Equal("recipient key is empty"))
})
It("should return error when pass an invalid recipient key", func() {
err := whisperHelper.SendAsymMsg(&Message{From: "46342e3c48021fc8e6d5a704ba84c56945037ef151ba38b21663767c0abb3c63", To: "nonHex"})
Expect(err.Error()).To(Equal("invalid recipient key"))
})
})
Describe("SendSymMsg", func() {
It("should return error when pass an empty password", func() {
err := whisperHelper.SendSymMsg("", &Message{})
Expect(err.Error()).To(Equal("password is empty"))
})
})
})