bbj2/server/cmd/api/api_test.go

37 lines
636 B
Go
Raw Normal View History

2022-06-01 03:27:55 +00:00
package api
import (
"testing"
"git.tilde.town/tildetown/bbj2/server/cmd/config"
)
func TestInstanceInfo(t *testing.T) {
ts := []struct {
name string
opts config.Options
wantResp *BBJResponse
2022-06-02 04:40:43 +00:00
wantErr *HTTPError
2022-06-01 03:27:55 +00:00
}{}
for _, tt := range ts {
t.Run(tt.name, func(t *testing.T) {
2022-06-02 04:40:43 +00:00
api := &API{
Opts: config.Options{
// TODO
},
User: nil,
}
resp, err := api.InstanceInfo()
if tt.wantErr != nil && err != nil {
t.Errorf("got unwanted error: %s", err.Error())
return
}
if tt.wantResp != resp {
t.Errorf("wanted %#v got %#v", tt.wantResp, resp)
return
}
2022-06-01 03:27:55 +00:00
})
}
}