Skip to content

Add slackAPI interface and inject dependencies for coverage#94

Merged
justinharringa merged 1 commit intomainfrom
slack-api-interface-coverage
Mar 5, 2026
Merged

Add slackAPI interface and inject dependencies for coverage#94
justinharringa merged 1 commit intomainfrom
slack-api-interface-coverage

Conversation

@justinharringa
Copy link
Collaborator

@justinharringa justinharringa commented Mar 5, 2026

Summary

  • Extracts a slackAPI interface mirroring slack.Client.PostMessage and adds a compile-time assertion (var _ slackAPI = (*slack.Client)(nil)) so any future breaking change to the slack-go/slack API fails the build immediately
  • Injects apiFactory and webhookPoster function fields into productionSlackClientWorker, replacing direct calls to slack.New and slack.PostWebhook
  • Adds tests for productionSlackClientWorker covering success and error paths for both postChannelMessage and postWebhookMessage
  • Adds two error-propagation cases to Test_PostToSlack_EdgeCases using NewTestClient(true, false) and NewTestClient(false, true)

Test plan

  • go build ./... passes (compile-time guard verified)
  • go test -race ./... passes with no failures
  • postChannelMessage (production): 0% → 100%
  • postWebhookMessage (production): 0% → 100%
  • Overall coverage: ~78% → 92%

Extract a slackAPI interface from slack-go/slack, inject apiFactory and
webhookPoster into productionSlackClientWorker, and add a compile-time
guard so breaking changes to PostMessage fail the build immediately.

Add tests for productionSlackClientWorker covering success and error
paths for both postChannelMessage and postWebhookMessage, plus two
error-propagation cases in PostToSlack. Coverage rises from ~78% to 92%.
@justinharringa justinharringa merged commit 61fc755 into main Mar 5, 2026
5 checks passed
@justinharringa justinharringa deleted the slack-api-interface-coverage branch March 5, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant