[MM-19118] Migrate tests from "model/websocket_message_test.go… (#12577)
* [MM-19118] Migrate tests from model/websocket_message_test.go to use testify * [MM-19118] Ran go fmt on websocket_message_test.go file
Этот коммит содержится в:
коммит произвёл
Michael Kochell
родитель
f010346945
Коммит
eebe1fc290
@@ -8,6 +8,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestWebSocketEvent(t *testing.T) {
|
func TestWebSocketEvent(t *testing.T) {
|
||||||
@@ -17,21 +18,13 @@ func TestWebSocketEvent(t *testing.T) {
|
|||||||
result := WebSocketEventFromJson(strings.NewReader(json))
|
result := WebSocketEventFromJson(strings.NewReader(json))
|
||||||
|
|
||||||
badresult := WebSocketEventFromJson(strings.NewReader("junk"))
|
badresult := WebSocketEventFromJson(strings.NewReader("junk"))
|
||||||
if badresult != nil {
|
require.Nil(t, badresult, "should not have parsed")
|
||||||
t.Fatal("should not have parsed")
|
|
||||||
}
|
|
||||||
|
|
||||||
if !m.IsValid() {
|
require.True(t, m.IsValid(), "should be valid")
|
||||||
t.Fatal("should be valid")
|
|
||||||
}
|
|
||||||
|
|
||||||
if m.Broadcast.TeamId != result.Broadcast.TeamId {
|
require.Equal(t, m.Broadcast.TeamId, result.Broadcast.TeamId, "Ids do not match")
|
||||||
t.Fatal("Ids do not match")
|
|
||||||
}
|
|
||||||
|
|
||||||
if m.Data["RootId"] != result.Data["RootId"] {
|
require.Equal(t, m.Data["RootId"], result.Data["RootId"], "Ids do not match")
|
||||||
t.Fatal("Ids do not match")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWebSocketResponse(t *testing.T) {
|
func TestWebSocketResponse(t *testing.T) {
|
||||||
@@ -44,17 +37,11 @@ func TestWebSocketResponse(t *testing.T) {
|
|||||||
WebSocketResponseFromJson(strings.NewReader(json2))
|
WebSocketResponseFromJson(strings.NewReader(json2))
|
||||||
|
|
||||||
badresult := WebSocketResponseFromJson(strings.NewReader("junk"))
|
badresult := WebSocketResponseFromJson(strings.NewReader("junk"))
|
||||||
if badresult != nil {
|
require.Nil(t, badresult, "should not have parsed")
|
||||||
t.Fatal("should not have parsed")
|
|
||||||
}
|
|
||||||
|
|
||||||
if !m.IsValid() {
|
require.True(t, m.IsValid(), "should be valid")
|
||||||
t.Fatal("should be valid")
|
|
||||||
}
|
|
||||||
|
|
||||||
if m.Data["RootId"] != result.Data["RootId"] {
|
require.Equal(t, m.Data["RootId"], result.Data["RootId"], "Ids do not match")
|
||||||
t.Fatal("Ids do not match")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWebSocketEvent_PrecomputeJSON(t *testing.T) {
|
func TestWebSocketEvent_PrecomputeJSON(t *testing.T) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user