2017-04-12 08:27:57 -04:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
2016-07-12 09:36:27 -04:00
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
|
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"strings"
|
|
|
|
|
"testing"
|
2019-10-12 00:00:23 +03:00
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
2016-07-12 09:36:27 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestWebSocketRequest(t *testing.T) {
|
|
|
|
|
m := WebSocketRequest{Seq: 1, Action: "test"}
|
|
|
|
|
json := m.ToJson()
|
|
|
|
|
result := WebSocketRequestFromJson(strings.NewReader(json))
|
|
|
|
|
|
2019-10-12 00:00:23 +03:00
|
|
|
require.NotNil(t, result)
|
2016-07-12 09:36:27 -04:00
|
|
|
|
|
|
|
|
badresult := WebSocketRequestFromJson(strings.NewReader("junk"))
|
|
|
|
|
|
2019-10-12 00:00:23 +03:00
|
|
|
require.Nil(t, badresult)
|
2016-07-12 09:36:27 -04:00
|
|
|
}
|