Files
mostlymatter/server/model/channel_member_test.go
Agniva De Sarker b200a07881 v8.0 module release (#22975)
https://mattermost.atlassian.net/browse/MM-52079

```release-note
We upgrade the module version to 8.0. The new module path is github.com/mattermost-server/server/v8.
```


Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
2023-04-18 11:05:28 +05:30

41 строка
1.0 KiB
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package model
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestChannelMemberIsValid(t *testing.T) {
o := ChannelMember{}
require.NotNil(t, o.IsValid(), "should be invalid")
o.ChannelId = NewId()
require.NotNil(t, o.IsValid(), "should be invalid")
o.NotifyProps = GetDefaultChannelNotifyProps()
o.UserId = NewId()
o.NotifyProps["desktop"] = "junk"
require.NotNil(t, o.IsValid(), "should be invalid")
o.NotifyProps["desktop"] = "123456789012345678901"
require.NotNil(t, o.IsValid(), "should be invalid")
o.NotifyProps["desktop"] = ChannelNotifyAll
require.Nil(t, o.IsValid(), "should be valid")
o.NotifyProps["mark_unread"] = "123456789012345678901"
require.NotNil(t, o.IsValid(), "should be invalid")
o.NotifyProps["mark_unread"] = ChannelMarkUnreadAll
require.Nil(t, o.IsValid(), "should be valid")
o.Roles = ""
require.Nil(t, o.IsValid(), "should be invalid")
}