MM-19132 Migrate tests from "model/channel_view_test.go" to us… (#12579)
* Migrate tests from "model/channel_view_test.go" to use testify * Replace require to assert
Этот коммит содержится в:
коммит произвёл
jfrerich
родитель
598f7c7255
Коммит
13b28b7a20
@@ -6,6 +6,8 @@ package model
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestChannelViewJson(t *testing.T) {
|
func TestChannelViewJson(t *testing.T) {
|
||||||
@@ -13,13 +15,8 @@ func TestChannelViewJson(t *testing.T) {
|
|||||||
json := o.ToJson()
|
json := o.ToJson()
|
||||||
ro := ChannelViewFromJson(strings.NewReader(json))
|
ro := ChannelViewFromJson(strings.NewReader(json))
|
||||||
|
|
||||||
if o.ChannelId != ro.ChannelId {
|
assert.Equal(t, o.ChannelId, ro.ChannelId, "ChannelIdIds do not match")
|
||||||
t.Fatal("ChannelIdIds do not match")
|
assert.Equal(t, o.PrevChannelId, ro.PrevChannelId, "PrevChannelIds do not match")
|
||||||
}
|
|
||||||
|
|
||||||
if o.PrevChannelId != ro.PrevChannelId {
|
|
||||||
t.Fatal("PrevChannelIds do not match")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestChannelViewResponseJson(t *testing.T) {
|
func TestChannelViewResponseJson(t *testing.T) {
|
||||||
@@ -28,11 +25,6 @@ func TestChannelViewResponseJson(t *testing.T) {
|
|||||||
json := o.ToJson()
|
json := o.ToJson()
|
||||||
ro := ChannelViewResponseFromJson(strings.NewReader(json))
|
ro := ChannelViewResponseFromJson(strings.NewReader(json))
|
||||||
|
|
||||||
if o.Status != ro.Status {
|
assert.Equal(t, o.Status, ro.Status, "ChannelIdIds do not match")
|
||||||
t.Fatal("ChannelIdIds do not match")
|
assert.Equal(t, o.LastViewedAtTimes[id], ro.LastViewedAtTimes[id], "LastViewedAtTimes do not match")
|
||||||
}
|
|
||||||
|
|
||||||
if o.LastViewedAtTimes[id] != ro.LastViewedAtTimes[id] {
|
|
||||||
t.Fatal("LastViewedAtTimes do not match")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user