From c1e67619d4bd9a7143e54590b05c55da97bc1cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20D=C3=B6tsch?= Date: Mon, 20 Nov 2023 12:53:16 +0100 Subject: [PATCH] test: cleanup mocks to find unwanted asserts --- bot/matcher/admin_test.go | 2 +- bot/matcher/group_test.go | 4 ++-- command/add_button_test.go | 2 +- command/add_link_test.go | 2 +- command/admin/bot_log_test.go | 2 +- command/admin/ping_test.go | 2 +- command/admin/stats_test.go | 2 +- command/clouds/aws/aws_test.go | 2 +- command/cron/cron_test.go | 2 +- command/custom_commmands/integration_test.go | 2 +- command/custom_variables/integration_test.go | 2 +- command/defined_commands_test.go | 4 ++-- command/delay_test.go | 2 +- command/games/number_guesser_test.go | 2 +- command/games/quiz_test.go | 2 +- command/help_test.go | 2 +- command/jenkins/client/start_build_test.go | 4 ++-- command/jenkins/commands_test.go | 2 +- command/jira/commands_test.go | 2 +- command/jira/comment_test.go | 2 +- command/jira/search_test.go | 2 +- command/jira/watch_test.go | 2 +- command/openai/dalle_test.go | 2 +- command/openai/openai_test.go | 3 +-- command/pool/commands_test.go | 2 +- command/pullrequest/bitbucket_test.go | 6 ++---- command/pullrequest/github_test.go | 2 +- command/pullrequest/gitlab_test.go | 2 +- command/pullrequest/pull_request_test.go | 7 +------ command/queue/queue_test.go | 5 ++--- command/random_test.go | 2 +- command/reaction_test.go | 2 +- command/reply_test.go | 2 +- command/retry_test.go | 3 +-- command/ripeatlas/ripeatlas_test.go | 2 +- command/send_message_test.go | 2 +- command/user_status_test.go | 2 +- command/vcs/vcs_test.go | 2 +- command/weather/weather_test.go | 2 +- 39 files changed, 44 insertions(+), 54 deletions(-) diff --git a/bot/matcher/admin_test.go b/bot/matcher/admin_test.go index 76bb126c..c5669ea9 100644 --- a/bot/matcher/admin_test.go +++ b/bot/matcher/admin_test.go @@ -11,7 +11,7 @@ import ( func TestAdmin(t *testing.T) { t.Run("Test no Admin", func(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) cfg := config.Config{} cfg.AdminUsers = []string{ diff --git a/bot/matcher/group_test.go b/bot/matcher/group_test.go index d8d0a942..d7612efd 100644 --- a/bot/matcher/group_test.go +++ b/bot/matcher/group_test.go @@ -22,7 +22,7 @@ func TestGroup(t *testing.T) { NewRegexpMatcher(`add reaction :(?P.*):`, testRunner), NewAdminMatcher( cfg.AdminUsers, - &mocks.SlackClient{}, + mocks.NewSlackClient(t), NewRegexpMatcher(`remove reaction :(?P.*):`, testRunner), ), ) @@ -62,7 +62,7 @@ func BenchmarkMatchChained(b *testing.B) { NewPrefixMatcher(`prefix`, testRunner), NewAdminMatcher( config.UserList{}, - &mocks.SlackClient{}, + mocks.NewSlackClient(b), NewTextMatcher(`text`, testRunner), ), NewVoidMatcher(), diff --git a/command/add_button_test.go b/command/add_button_test.go index 94b578db..b0525252 100644 --- a/command/add_button_test.go +++ b/command/add_button_test.go @@ -10,7 +10,7 @@ import ( ) func TestAddButton(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} diff --git a/command/add_link_test.go b/command/add_link_test.go index 5b09742d..899ab34c 100644 --- a/command/add_link_test.go +++ b/command/add_link_test.go @@ -10,7 +10,7 @@ import ( ) func TestAddLink(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} command := bot.Commands{} diff --git a/command/admin/bot_log_test.go b/command/admin/bot_log_test.go index e869eb7b..719b6721 100644 --- a/command/admin/bot_log_test.go +++ b/command/admin/bot_log_test.go @@ -15,7 +15,7 @@ import ( func TestBotLog(t *testing.T) { testFile := "test.log" - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} client.AllUsers = config.UserMap{ diff --git a/command/admin/ping_test.go b/command/admin/ping_test.go index d72d85da..ebcf1dbd 100644 --- a/command/admin/ping_test.go +++ b/command/admin/ping_test.go @@ -12,7 +12,7 @@ import ( ) func TestPing(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} botLog := newPingCommand(base) diff --git a/command/admin/stats_test.go b/command/admin/stats_test.go index bc6e3a1d..6fa5ec2a 100644 --- a/command/admin/stats_test.go +++ b/command/admin/stats_test.go @@ -12,7 +12,7 @@ import ( ) func TestStatsLog(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} cfg := &config.Config{} diff --git a/command/clouds/aws/aws_test.go b/command/clouds/aws/aws_test.go index 18d862ed..c7302610 100644 --- a/command/clouds/aws/aws_test.go +++ b/command/clouds/aws/aws_test.go @@ -11,7 +11,7 @@ import ( ) func TestGetCommands(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} t.Run("AWS is not active", func(t *testing.T) { diff --git a/command/cron/cron_test.go b/command/cron/cron_test.go index d4f5262f..d0ea7256 100644 --- a/command/cron/cron_test.go +++ b/command/cron/cron_test.go @@ -15,7 +15,7 @@ import ( ) func TestCron(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} crons := []config.Cron{ diff --git a/command/custom_commmands/integration_test.go b/command/custom_commmands/integration_test.go index 33ecafab..86a4db7e 100644 --- a/command/custom_commmands/integration_test.go +++ b/command/custom_commmands/integration_test.go @@ -12,7 +12,7 @@ import ( ) func TestCustomCommands(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} lock := mocks.LockInternalMessages() diff --git a/command/custom_variables/integration_test.go b/command/custom_variables/integration_test.go index 5ab5f8ed..849628d5 100644 --- a/command/custom_variables/integration_test.go +++ b/command/custom_variables/integration_test.go @@ -12,7 +12,7 @@ import ( ) func TestCustomCommands(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} cfg := &config.Config{} diff --git a/command/defined_commands_test.go b/command/defined_commands_test.go index aa455348..f39d5c4e 100644 --- a/command/defined_commands_test.go +++ b/command/defined_commands_test.go @@ -12,7 +12,7 @@ import ( ) func TestInvalidMacro(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} client.InternalMessages = make(chan msg.Message, 2) @@ -55,7 +55,7 @@ func TestInvalidMacro(t *testing.T) { } func TestDefinedCommands(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} lock := mocks.LockInternalMessages() diff --git a/command/delay_test.go b/command/delay_test.go index bca63fd0..dc5ea311 100644 --- a/command/delay_test.go +++ b/command/delay_test.go @@ -15,7 +15,7 @@ import ( func TestDelay(t *testing.T) { client.InternalMessages = make(chan msg.Message, 2) - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} diff --git a/command/games/number_guesser_test.go b/command/games/number_guesser_test.go index 912848e4..c0fbcfcb 100644 --- a/command/games/number_guesser_test.go +++ b/command/games/number_guesser_test.go @@ -11,7 +11,7 @@ import ( ) func TestNumberGuesser(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} command := NewNumberGuesserCommand(base) diff --git a/command/games/quiz_test.go b/command/games/quiz_test.go index 6722548e..53e39093 100644 --- a/command/games/quiz_test.go +++ b/command/games/quiz_test.go @@ -13,7 +13,7 @@ import ( ) func TestQuiz(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/command/help_test.go b/command/help_test.go index c487201a..8cc3fbad 100644 --- a/command/help_test.go +++ b/command/help_test.go @@ -14,7 +14,7 @@ import ( func TestHelp(t *testing.T) { cfg := config.Config{} cfg.Jenkins.Host = "bitbucket.example.com" - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} diff --git a/command/jenkins/client/start_build_test.go b/command/jenkins/client/start_build_test.go index d98a9a9e..71cecdfa 100644 --- a/command/jenkins/client/start_build_test.go +++ b/command/jenkins/client/start_build_test.go @@ -18,7 +18,7 @@ import ( ) func TestStartBuild(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) cfg := config.JobConfig{} message := msg.Message{} @@ -143,7 +143,7 @@ func TestGetAttachment(t *testing.T) { } func TestSendBuildStartedMessage(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) ref := msg.MessageRef{} job := &gojenkins.Job{ diff --git a/command/jenkins/commands_test.go b/command/jenkins/commands_test.go index e6489209..53ada379 100644 --- a/command/jenkins/commands_test.go +++ b/command/jenkins/commands_test.go @@ -20,7 +20,7 @@ func getTestJenkinsCommand() (*mocks.SlackClient, *mocks.Client, jenkinsCommand) } func TestGetCommands(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} t.Run("Jenkins is not active", func(t *testing.T) { diff --git a/command/jira/commands_test.go b/command/jira/commands_test.go index 5cae7f71..98384f2a 100644 --- a/command/jira/commands_test.go +++ b/command/jira/commands_test.go @@ -9,7 +9,7 @@ import ( ) func TestCommands(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) cfg := &config.Jira{ Host: "https://issues.apache.org/jira/", diff --git a/command/jira/comment_test.go b/command/jira/comment_test.go index 58efb09b..e3cdb3f4 100644 --- a/command/jira/comment_test.go +++ b/command/jira/comment_test.go @@ -13,7 +13,7 @@ import ( ) func TestCommentJira(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) mux := http.NewServeMux() server := httptest.NewServer(mux) diff --git a/command/jira/search_test.go b/command/jira/search_test.go index 71202ef5..c82ec548 100644 --- a/command/jira/search_test.go +++ b/command/jira/search_test.go @@ -14,7 +14,7 @@ import ( ) func TestJiraSearch(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) cfg := &config.Jira{ Host: "https://issues.apache.org/jira/", diff --git a/command/jira/watch_test.go b/command/jira/watch_test.go index a1bce9d4..b149ddd2 100644 --- a/command/jira/watch_test.go +++ b/command/jira/watch_test.go @@ -11,7 +11,7 @@ import ( ) func TestWatchJira(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) // todo fake http client cfg := &config.Jira{ diff --git a/command/openai/dalle_test.go b/command/openai/dalle_test.go index d1e68f81..78eb00b7 100644 --- a/command/openai/dalle_test.go +++ b/command/openai/dalle_test.go @@ -19,7 +19,7 @@ func TestDalle(t *testing.T) { // init memory based storage storage.InitStorage("") - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} t.Run("test http error", func(t *testing.T) { diff --git a/command/openai/openai_test.go b/command/openai/openai_test.go index e0195fed..104f86ea 100644 --- a/command/openai/openai_test.go +++ b/command/openai/openai_test.go @@ -61,7 +61,7 @@ func TestOpenai(t *testing.T) { // init memory based storage storage.InitStorage("") - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} t.Run("Openai is not active", func(t *testing.T) { @@ -157,7 +157,6 @@ data: [DONE]`, mocks.AssertReaction(slackClient, ":coffee:", message) mocks.AssertRemoveReaction(slackClient, ":coffee:", message) mocks.AssertSlackMessage(slackClient, message, "...", mock.Anything) - mocks.AssertSlackMessage(slackClient, message, "The answer is 3", mock.Anything) actual = commands.Run(message) queue.WaitTillHavingNoQueuedMessage() diff --git a/command/pool/commands_test.go b/command/pool/commands_test.go index 39a8edac..7e05fc7c 100644 --- a/command/pool/commands_test.go +++ b/command/pool/commands_test.go @@ -15,7 +15,7 @@ import ( var _ bot.Runnable = &poolCommands{} func TestPools(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} t.Run("Pools are not active", func(t *testing.T) { diff --git a/command/pullrequest/bitbucket_test.go b/command/pullrequest/bitbucket_test.go index 32859682..1eeffca0 100644 --- a/command/pullrequest/bitbucket_test.go +++ b/command/pullrequest/bitbucket_test.go @@ -18,7 +18,7 @@ import ( ) func TestBitbucketNotActive(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} cfg := &config.DefaultConfig @@ -42,7 +42,7 @@ func TestBitbucketNotActive(t *testing.T) { } func TestBitbucketFakeServer(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} server := spawnBitbucketTestServer() @@ -65,8 +65,6 @@ func TestBitbucketFakeServer(t *testing.T) { message.Text = server.URL + "/projects/myProject/repos/myRepo/pull-requests/1339 please review ASAP!" slackClient.On("GetReactions", message.GetMessageRef(), slack.NewGetReactionsParameters()).Return([]slack.ItemReaction{}, nil) - mocks.AssertReaction(slackClient, "white_check_mark", message) - mocks.AssertReaction(slackClient, "twisted_rightwards_arrows", message) actual := command.Run(message) assert.True(t, actual) diff --git a/command/pullrequest/github_test.go b/command/pullrequest/github_test.go index 6d2fa54d..8622fca8 100644 --- a/command/pullrequest/github_test.go +++ b/command/pullrequest/github_test.go @@ -18,7 +18,7 @@ import ( ) func TestGithub(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} cfg := &config.DefaultConfig diff --git a/command/pullrequest/gitlab_test.go b/command/pullrequest/gitlab_test.go index de137c51..de5a932a 100644 --- a/command/pullrequest/gitlab_test.go +++ b/command/pullrequest/gitlab_test.go @@ -14,7 +14,7 @@ import ( ) func TestGitlab(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} server := spawnTestServer() diff --git a/command/pullrequest/pull_request_test.go b/command/pullrequest/pull_request_test.go index 217b77f5..e56186b5 100644 --- a/command/pullrequest/pull_request_test.go +++ b/command/pullrequest/pull_request_test.go @@ -30,7 +30,7 @@ func (t *testFetcher) getHelp() []bot.Help { } func TestGetCommands(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} cfg := &config.Config{} @@ -82,7 +82,6 @@ func TestPullRequest(t *testing.T) { slackClient. On("GetReactions", msgRef, slack.NewGetReactionsParameters()).Return(nil, nil) - mocks.AssertRemoveReaction(slackClient, "eyes", message) mocks.AssertReaction(slackClient, "project_approve", message) mocks.AssertReaction(slackClient, "twisted_rightwards_arrows", message) @@ -102,8 +101,6 @@ func TestPullRequest(t *testing.T) { } message.Text = "vcd.example.com/projects/foo/repos/bar/pull-requests/1337" - mocks.AssertRemoveReaction(slackClient, "eyes", message) - mocks.AssertRemoveReaction(slackClient, "project_approve", message) mocks.AssertReaction(slackClient, "x", message) actual := commands.Run(message) @@ -122,8 +119,6 @@ func TestPullRequest(t *testing.T) { } message.Text = "vcd.example.com/projects/foo/repos/bar/pull-requests/1337" - mocks.AssertRemoveReaction(slackClient, "eyed", message) - mocks.AssertRemoveReaction(slackClient, "x", message) mocks.AssertReaction(slackClient, "approve_backend", message) actual := commands.Run(message) diff --git a/command/queue/queue_test.go b/command/queue/queue_test.go index 498cb6ec..17f183c9 100644 --- a/command/queue/queue_test.go +++ b/command/queue/queue_test.go @@ -16,7 +16,7 @@ import ( func TestQueue(t *testing.T) { client.InternalMessages = make(chan msg.Message, 2) - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} message := msg.Message{} @@ -83,7 +83,6 @@ func TestQueue(t *testing.T) { mocks.AssertReaction(slackClient, waitIcon, message) mocks.AssertReaction(slackClient, doneIcon, message) - mocks.AssertRemoveReaction(slackClient, waitIcon, message) actual := command.Run(message) assert.True(t, actual) @@ -164,7 +163,7 @@ func TestQueue(t *testing.T) { func TestFallbackQueue(t *testing.T) { client.InternalMessages = make(chan msg.Message, 2) - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} message := msg.Message{} diff --git a/command/random_test.go b/command/random_test.go index 383dacd1..e79ae7eb 100644 --- a/command/random_test.go +++ b/command/random_test.go @@ -10,7 +10,7 @@ import ( ) func TestRandom(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} randomCommand := NewRandomCommand(base).(*randomCommand) diff --git a/command/reaction_test.go b/command/reaction_test.go index 8ec6637f..43458534 100644 --- a/command/reaction_test.go +++ b/command/reaction_test.go @@ -10,7 +10,7 @@ import ( ) func TestReaction(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} reaction := NewReactionCommand(base) diff --git a/command/reply_test.go b/command/reply_test.go index 282a0e4c..dee5b0f3 100644 --- a/command/reply_test.go +++ b/command/reply_test.go @@ -11,7 +11,7 @@ import ( ) func TestReply(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} reply := NewReplyCommand(base) diff --git a/command/retry_test.go b/command/retry_test.go index c626638e..ba3fed8a 100644 --- a/command/retry_test.go +++ b/command/retry_test.go @@ -18,7 +18,7 @@ func TestRetry(t *testing.T) { defer lock.Unlock() client.InternalMessages = make(chan msg.Message, 2) - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) cfg := &config.Config{} base := bot.BaseCommand{SlackClient: slackClient} @@ -152,7 +152,6 @@ func TestRetry(t *testing.T) { &slack.GetConversationHistoryParameters{ChannelID: "D0183HUURA9", Inclusive: true, Latest: "1607971366.001001", Limit: 1}, ).Return(&slack.GetConversationHistoryResponse{Messages: []slack.Message{history}}, nil) mocks.AssertReaction(slackClient, "✅", message) - mocks.AssertSlackMessage(slackClient, message, "this is not your message") actual := retry.Run(message) diff --git a/command/ripeatlas/ripeatlas_test.go b/command/ripeatlas/ripeatlas_test.go index e89f6ce1..eeab5a37 100644 --- a/command/ripeatlas/ripeatlas_test.go +++ b/command/ripeatlas/ripeatlas_test.go @@ -92,7 +92,7 @@ func spawnRIPEAtlasServer(t *testing.T) *httptest.Server { } func TestRipeAtlas(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} t.Run("RIPE Atlas is not active", func(t *testing.T) { diff --git a/command/send_message_test.go b/command/send_message_test.go index bbbbe387..b24c39e7 100644 --- a/command/send_message_test.go +++ b/command/send_message_test.go @@ -10,7 +10,7 @@ import ( ) func TestSendMessage(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} command := bot.Commands{} diff --git a/command/user_status_test.go b/command/user_status_test.go index 7fbee9aa..ccbb7834 100644 --- a/command/user_status_test.go +++ b/command/user_status_test.go @@ -14,7 +14,7 @@ import ( ) func TestUserStatus(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} command := newUserStatusCommand(base) diff --git a/command/vcs/vcs_test.go b/command/vcs/vcs_test.go index af2f1745..d992b471 100644 --- a/command/vcs/vcs_test.go +++ b/command/vcs/vcs_test.go @@ -15,7 +15,7 @@ import ( var _ bot.Runnable = &vcsCommand{} func TestVCS(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} t.Run("Test disabled", func(t *testing.T) { diff --git a/command/weather/weather_test.go b/command/weather/weather_test.go index 2e54ee6a..279761b4 100644 --- a/command/weather/weather_test.go +++ b/command/weather/weather_test.go @@ -17,7 +17,7 @@ import ( ) func TestWeather(t *testing.T) { - slackClient := &mocks.SlackClient{} + slackClient := mocks.NewSlackClient(t) base := bot.BaseCommand{SlackClient: slackClient} // set default timezone