Skip to content

Commit

Permalink
test: bump test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
wass3r committed Jul 18, 2021
1 parent 57e9faa commit 5b46d0e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions core/configure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,24 @@ func Test_configureChatApplication(t *testing.T) {
testBotDiscordBadServerID.DiscordServerID = "${TOKEN}"
validateRemoteSetup(testBotDiscordServerID)

testBotTelegram := new(models.Bot)
testBotTelegram.CLI = true
testBotTelegram.ChatApplication = "telegram"
testBotTelegram.TelegramToken = "${TEST_TELEGRAM_TOKEN}"
os.Setenv("TEST_TELEGRAM_TOKEN", "TESTTOKEN")
validateRemoteSetup(testBotTelegram)

testBotTelegramNoToken := new(models.Bot)
testBotTelegramNoToken.CLI = true
testBotTelegramNoToken.ChatApplication = "telegram"
validateRemoteSetup(testBotTelegramNoToken)

testBotTelegramBadToken := new(models.Bot)
testBotTelegramBadToken.CLI = true
testBotTelegramBadToken.ChatApplication = "telegram"
testBotTelegramBadToken.TelegramToken = "${TOKEN}"
validateRemoteSetup(testBotTelegramBadToken)

tests := []struct {
name string
args args
Expand All @@ -133,6 +151,9 @@ func Test_configureChatApplication(t *testing.T) {
{"Discord - bad token", args{bot: testBotDiscordBadToken}, false, false},
{"Discord w/ server id", args{bot: testBotDiscordServerID}, true, false},
{"Discord w/ bad server id", args{bot: testBotDiscordBadServerID}, false, false},
{"Telegram", args{bot: testBotTelegram}, true, false},
{"Telegram - no token", args{bot: testBotTelegramNoToken}, false, false},
{"Telegram - bad token", args{bot: testBotTelegramBadToken}, false, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 5b46d0e

Please sign in to comment.