mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-19234 Migrate tests from model/team_member_test.go to use testify (#12642)
This commit is contained in:
committed by
Harrison Healey
parent
ff160a4d32
commit
fffcef0b00
@@ -6,6 +6,8 @@ package model
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestTeamMemberJson(t *testing.T) {
|
||||
@@ -13,22 +15,17 @@ func TestTeamMemberJson(t *testing.T) {
|
||||
json := o.ToJson()
|
||||
ro := TeamMemberFromJson(strings.NewReader(json))
|
||||
|
||||
if o.TeamId != ro.TeamId {
|
||||
t.Fatal("Ids do not match")
|
||||
}
|
||||
require.Equal(t, o.TeamId, ro.TeamId, "Ids do not match")
|
||||
}
|
||||
|
||||
func TestTeamMemberIsValid(t *testing.T) {
|
||||
o := TeamMember{}
|
||||
|
||||
if err := o.IsValid(); err == nil {
|
||||
t.Fatal("should be invalid")
|
||||
}
|
||||
require.Error(t, o.IsValid(), "should be invalid")
|
||||
|
||||
o.TeamId = NewId()
|
||||
if err := o.IsValid(); err == nil {
|
||||
t.Fatal("should be invalid")
|
||||
}
|
||||
|
||||
require.Error(t, o.IsValid(), "should be invalid")
|
||||
|
||||
/*o.UserId = NewId()
|
||||
o.Roles = "blahblah"
|
||||
@@ -47,11 +44,8 @@ func TestUnreadMemberJson(t *testing.T) {
|
||||
json := o.ToJson()
|
||||
|
||||
r := TeamUnreadFromJson(strings.NewReader(json))
|
||||
if o.TeamId != r.TeamId {
|
||||
t.Fatal("Ids do not match")
|
||||
}
|
||||
|
||||
if o.MsgCount != r.MsgCount {
|
||||
t.Fatal("MsgCount do not match")
|
||||
}
|
||||
require.Equal(t, o.TeamId, r.TeamId, "Ids do not match")
|
||||
|
||||
require.Equal(t, o.MsgCount, r.MsgCount, "MsgCount do not match")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user