-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from keybase/david/bot-announce
Add feature for bot to announce itself at startup
- Loading branch information
Showing
5 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package bot | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestBuildAnnouncement(t *testing.T) { | ||
values := AnnouncementTemplateValues{Username: "my_username", CurrentTeam: "my_cur_team", Teams: []string{"my_team1", "my_team2"}} | ||
|
||
require.Equal(t, "", | ||
buildAnnouncement("", values)) | ||
require.Equal(t, "no templates", | ||
buildAnnouncement("no templates", values)) | ||
require.Equal(t, "repeated my_username my_username my_username", | ||
buildAnnouncement("repeated {USERNAME} {USERNAME} {USERNAME}", values)) | ||
require.Equal(t, "all my_username my_cur_team my_team1, my_team2", | ||
buildAnnouncement("all {USERNAME} {CURRENT_TEAM} {TEAMS}", values)) | ||
require.Equal(t, "bogus {FOO}", | ||
buildAnnouncement("bogus {FOO}", values)) | ||
require.Equal(t, "double-is-not-escape {my_username}", | ||
buildAnnouncement("double-is-not-escape {{USERNAME}}", values)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters