From 13b28b7a208ab0ba7e3ca99fcc10d2354a282fe6 Mon Sep 17 00:00:00 2001 From: Vitalii Ananichev Date: Tue, 8 Oct 2019 17:22:07 +0300 Subject: [PATCH] =?UTF-8?q?MM-19132=20Migrate=20tests=20from=20"model/chan?= =?UTF-8?q?nel=5Fview=5Ftest.go"=20to=20us=E2=80=A6=20(#12579)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Migrate tests from "model/channel_view_test.go" to use testify * Replace require to assert --- model/channel_view_test.go | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/model/channel_view_test.go b/model/channel_view_test.go index fac455a742..7f99133b80 100644 --- a/model/channel_view_test.go +++ b/model/channel_view_test.go @@ -6,6 +6,8 @@ package model import ( "strings" "testing" + + "github.com/stretchr/testify/assert" ) func TestChannelViewJson(t *testing.T) { @@ -13,13 +15,8 @@ func TestChannelViewJson(t *testing.T) { json := o.ToJson() ro := ChannelViewFromJson(strings.NewReader(json)) - if o.ChannelId != ro.ChannelId { - t.Fatal("ChannelIdIds do not match") - } - - if o.PrevChannelId != ro.PrevChannelId { - t.Fatal("PrevChannelIds do not match") - } + assert.Equal(t, o.ChannelId, ro.ChannelId, "ChannelIdIds do not match") + assert.Equal(t, o.PrevChannelId, ro.PrevChannelId, "PrevChannelIds do not match") } func TestChannelViewResponseJson(t *testing.T) { @@ -28,11 +25,6 @@ func TestChannelViewResponseJson(t *testing.T) { json := o.ToJson() ro := ChannelViewResponseFromJson(strings.NewReader(json)) - if o.Status != ro.Status { - t.Fatal("ChannelIdIds do not match") - } - - if o.LastViewedAtTimes[id] != ro.LastViewedAtTimes[id] { - t.Fatal("LastViewedAtTimes do not match") - } + assert.Equal(t, o.Status, ro.Status, "ChannelIdIds do not match") + assert.Equal(t, o.LastViewedAtTimes[id], ro.LastViewedAtTimes[id], "LastViewedAtTimes do not match") }