github.com/coincircle/mattermost-server@v4.8.1-0.20180321182714-9d701c704416+incompatible/app/command_channel_header_test.go (about) 1 package app 2 3 import ( 4 "testing" 5 6 "github.com/mattermost/mattermost-server/model" 7 "github.com/stretchr/testify/assert" 8 ) 9 10 func TestHeaderProviderDoCommand(t *testing.T) { 11 th := Setup().InitBasic() 12 defer th.TearDown() 13 14 hp := HeaderProvider{} 15 args := &model.CommandArgs{ 16 T: func(s string, args ...interface{}) string { return s }, 17 ChannelId: th.BasicChannel.Id, 18 Session: model.Session{UserId: th.BasicUser.Id, TeamMembers: []*model.TeamMember{{TeamId: th.BasicTeam.Id, Roles: model.TEAM_USER_ROLE_ID}}}, 19 } 20 21 for msg, expected := range map[string]string{ 22 "": "api.command_channel_header.message.app_error", 23 "hello": "", 24 } { 25 actual := hp.DoCommand(th.App, args, msg).Text 26 assert.Equal(t, expected, actual) 27 } 28 }