TL;DR: Please change binder to Binder in slacktest/server.go.
The binder type is defined as such in slacktest/server.go:
type binder func(Customize)
This is only used in the signature of func NewTestServer(custom ...binder) *Server.
Due to the order of initialization of the handlers, once a handler is initialized, calling the Handler method again will be ignored. The NewTestServer function initializes a bunch of handlers.
In one of our tests, we wanted to redefine /conversations.info and some others, and the only way we could do so was to supply them like so:
However this is not amenable to table-driven tests. We'd like to be able to create our own []slacktest.Binder and pass these to slacktest.NewTestServer running in a subtest.
t.Run(testcase.Name, func(t *testing.T) {
s := slacktest.NewTestServer(testcase.CustomFuncs...)
// ...
}
However, because binder is private, there is no way to do this.
With Binder exported we can create []slacktest.Binder as an entry in each row of our table-driven tests and then pass this slice to NewTestServer as we would prefer.
Description
TL;DR: Please change
binder
toBinder
inslacktest/server.go
.The
binder
type is defined as such inslacktest/server.go
:This is only used in the signature of
func NewTestServer(custom ...binder) *Server
.Due to the order of initialization of the handlers, once a handler is initialized, calling the
Handler
method again will be ignored. TheNewTestServer
function initializes a bunch of handlers.In one of our tests, we wanted to redefine
/conversations.info
and some others, and the only way we could do so was to supply them like so:However this is not amenable to table-driven tests. We'd like to be able to create our own
[]slacktest.Binder
and pass these toslacktest.NewTestServer
running in a subtest.However, because
binder
is private, there is no way to do this.With
Binder
exported we can create[]slacktest.Binder
as an entry in each row of our table-driven tests and then pass this slice toNewTestServer
as we would prefer.