N
N
NubasLol2019-05-31 19:51:27
go
NubasLol, 2019-05-31 19:51:27

How to write tests in GO?

How to properly test such a controller? Replace hard binding with an interface, and create your own struct with a method to return the user?

type Controller struct {
  authManager *auth.AuthManager
}

type AuthManager struct {
  AB *authboss.Authboss
}

func (a AuthManager) GetAuthUser(r *http.Request) *models.User {}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question