summaryrefslogtreecommitdiff
path: root/internal/api/client/statuses/statusunpin_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-08-02 17:21:46 +0200
committerLibravatar GitHub <noreply@github.com>2023-08-02 17:21:46 +0200
commite8a20f587c0b0129bc68f5c6092c54f2b4c3519a (patch)
tree3677b4abec2cabf3b5042115ba76505daf5fddf3 /internal/api/client/statuses/statusunpin_test.go
parent[bugfix] fix slow accounts / statuses using emojis lookups (#2056) (diff)
downloadgotosocial-e8a20f587c0b0129bc68f5c6092c54f2b4c3519a.tar.xz
[bugfix] Rework MultiError to wrap + unwrap errors properly (#2057)
* rework multierror a bit * test multierror
Diffstat (limited to 'internal/api/client/statuses/statusunpin_test.go')
-rw-r--r--internal/api/client/statuses/statusunpin_test.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/internal/api/client/statuses/statusunpin_test.go b/internal/api/client/statuses/statusunpin_test.go
index bc68a2ca3..9f6602b98 100644
--- a/internal/api/client/statuses/statusunpin_test.go
+++ b/internal/api/client/statuses/statusunpin_test.go
@@ -19,7 +19,6 @@ package statuses_test
import (
"encoding/json"
- "fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
@@ -68,20 +67,20 @@ func (suite *StatusUnpinTestSuite) createUnpin(
return nil, err
}
- errs := gtserror.MultiError{}
+ errs := gtserror.NewMultiError(2)
- // check code + body
+ // Check expected code + body.
if resultCode := recorder.Code; expectedHTTPStatus != resultCode {
- errs = append(errs, fmt.Sprintf("expected %d got %d", expectedHTTPStatus, resultCode))
+ errs.Appendf("expected %d got %d", expectedHTTPStatus, resultCode)
}
- // if we got an expected body, return early
+ // If we got an expected body, return early.
if expectedBody != "" && string(b) != expectedBody {
- errs = append(errs, fmt.Sprintf("expected %s got %s", expectedBody, string(b)))
+ errs.Appendf("expected %s got %s", expectedBody, string(b))
}
- if len(errs) > 0 {
- return nil, errs.Combine()
+ if err := errs.Combine(); err != nil {
+ suite.FailNow("", "%v (body %s)", err, string(b))
}
resp := &apimodel.Status{}