Skip to content

Commit

Permalink
chore: add MsgUnparsedMessage and MsgUnsupportedMessage tests
Browse files Browse the repository at this point in the history
  • Loading branch information
freak12techno committed Jul 23, 2024
1 parent d6b4e5b commit 3003550
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pkg/messages/msg_unparsed_message_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package messages

import (
"errors"
"github.com/stretchr/testify/require"

Check failure on line 5 in pkg/messages/msg_unparsed_message_test.go

View workflow job for this annotation

GitHub Actions / lint

File is not `goimports`-ed (goimports)
"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())
}
23 changes: 23 additions & 0 deletions pkg/messages/msg_unsupported_message_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package messages

import (
"github.com/stretchr/testify/require"

Check failure on line 4 in pkg/messages/msg_unsupported_message_test.go

View workflow job for this annotation

GitHub Actions / lint

File is not `goimports`-ed (goimports)
"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())
}

0 comments on commit 3003550

Please sign in to comment.