summaryrefslogtreecommitdiffstats
path: root/app/command_channel_header_test.go
blob: 5fdde122baa679d95e24d7f68c7c73ca41bc4534 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package app

import (
	"testing"

	"github.com/mattermost/mattermost-server/model"
	"github.com/stretchr/testify/assert"
)

func TestHeaderProviderDoCommand(t *testing.T) {
	th := Setup().InitBasic()
	defer th.TearDown()

	hp := HeaderProvider{}
	args := &model.CommandArgs{
		T:         func(s string, args ...interface{}) string { return s },
		ChannelId: th.BasicChannel.Id,
		Session:   model.Session{UserId: th.BasicUser.Id, TeamMembers: []*model.TeamMember{{TeamId: th.BasicTeam.Id, Roles: model.ROLE_TEAM_USER.Id}}},
	}

	for msg, expected := range map[string]string{
		"":      "api.command_channel_header.message.app_error",
		"hello": "",
	} {
		actual := hp.DoCommand(th.App, args, msg).Text
		assert.Equal(t, expected, actual)
	}
}