mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* Replacing require.nil in model package * Fixing tests * Update model/file_info_test.go Co-authored-by: Doug Lauder <wiggin77@warpmail.net> * Update model/file_info_test.go Co-authored-by: Doug Lauder <wiggin77@warpmail.net> Co-authored-by: Doug Lauder <wiggin77@warpmail.net> Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
41 lines
927 B
Go
41 lines
927 B
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package model
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestTeamMemberJson(t *testing.T) {
|
|
o := TeamMember{TeamId: NewId(), UserId: NewId()}
|
|
json := o.ToJson()
|
|
ro := TeamMemberFromJson(strings.NewReader(json))
|
|
|
|
require.Equal(t, o.TeamId, ro.TeamId, "Ids do not match")
|
|
}
|
|
|
|
func TestTeamMemberIsValid(t *testing.T) {
|
|
o := TeamMember{}
|
|
|
|
require.NotNil(t, o.IsValid(), "should be invalid")
|
|
|
|
o.TeamId = NewId()
|
|
|
|
require.NotNil(t, o.IsValid(), "should be invalid")
|
|
}
|
|
|
|
func TestUnreadMemberJson(t *testing.T) {
|
|
o := TeamUnread{TeamId: NewId(), MsgCount: 5, MentionCount: 3}
|
|
json := o.ToJson()
|
|
|
|
r := TeamUnreadFromJson(strings.NewReader(json))
|
|
|
|
require.Equal(t, o.TeamId, r.TeamId, "Ids do not match")
|
|
|
|
require.Equal(t, o.MsgCount, r.MsgCount, "MsgCount do not match")
|
|
}
|