slack-go / slack

Slack API in Go, originally by @nlopes; Maintainers needed, contact @parsley42
https://pkg.go.dev/github.com/slack-go/slack
BSD 2-Clause "Simplified" License
4.63k stars 1.12k forks source link

Export the Binder type in slacktest #1177

Closed kpaulisse closed 1 year ago

kpaulisse commented 1 year ago

Fixes https://github.com/slack-go/slack/issues/1176

The binder type is defined as such in slacktest/server.go:

type binder func(Customize)

This PR changes slacktest.binder to slacktest.Binder. The reason for doing this is to be able to define a slice of custom functions to pass to the constructor. This makes things much easier for table-driven tests. Without this change, each entry in the table has to build its own *slacktest.Server which is less than convenient.

As far as I can tell these are the only places in the code where binder is used explicitly. There are only a few tests in this entire project that actually do these customizations (three tests in websocket_managed_conn_test.go). I've explicitly tested that this change has no effect on those tests.