-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add MsgUnparsedMessage and MsgUnsupportedMessage tests
- Loading branch information
1 parent
d6b4e5b
commit 3003550
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package messages | ||
|
||
import ( | ||
"errors" | ||
"github.com/stretchr/testify/require" | ||
"main/pkg/types" | ||
"testing" | ||
) | ||
|
||
func TestMsgUnparsedMessageBase(t *testing.T) { | ||
t.Parallel() | ||
|
||
msg := MsgUnparsedMessage{MsgType: "type", Error: errors.New("error")} | ||
|
||
require.Equal(t, "MsgUnparsedMessage", msg.Type()) | ||
|
||
msg.AddParsedMessage(nil) | ||
msg.SetParsedMessages([]types.Message{}) | ||
msg.GetAdditionalData(nil, "subscription") | ||
|
||
require.Empty(t, msg.GetValues()) | ||
require.Empty(t, msg.GetParsedMessages()) | ||
require.Empty(t, msg.GetRawMessages()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package messages | ||
|
||
import ( | ||
"github.com/stretchr/testify/require" | ||
"main/pkg/types" | ||
"testing" | ||
) | ||
|
||
func TestMsgUnsupportedMessageBase(t *testing.T) { | ||
t.Parallel() | ||
|
||
msg := MsgUnsupportedMessage{MsgType: "type"} | ||
|
||
require.Equal(t, "MsgUnsupportedMessage", msg.Type()) | ||
|
||
msg.AddParsedMessage(nil) | ||
msg.SetParsedMessages([]types.Message{}) | ||
msg.GetAdditionalData(nil, "subscription") | ||
|
||
require.Empty(t, msg.GetValues()) | ||
require.Empty(t, msg.GetParsedMessages()) | ||
require.Empty(t, msg.GetRawMessages()) | ||
} |