[chore] Remove omitempty on account source; refactor tests to use prettyprint json (#1337)

* remove omitEmpty tag on account source items

* update tests
This commit is contained in:
tobi
2023-01-13 17:02:45 +01:00
committed by GitHub
parent 5318054808
commit eafd73c292
18 changed files with 1605 additions and 163 deletions

View File

@@ -19,6 +19,8 @@
package admin_test
import (
"bytes"
"encoding/json"
"io"
"net/http"
"net/http/httptest"
@@ -44,8 +46,19 @@ func (suite *EmojiCategoriesGetTestSuite) TestEmojiCategoriesGet() {
b, err := io.ReadAll(recorder.Body)
suite.NoError(err)
suite.NotNil(b)
suite.Equal(`[{"id":"01GGQ989PTT9PMRN4FZ1WWK2B9","name":"cute stuff"},{"id":"01GGQ8V4993XK67B2JB396YFB7","name":"reactions"}]`, string(b))
dst := new(bytes.Buffer)
err = json.Indent(dst, b, "", " ")
suite.NoError(err)
suite.Equal(`[
{
"id": "01GGQ989PTT9PMRN4FZ1WWK2B9",
"name": "cute stuff"
},
{
"id": "01GGQ8V4993XK67B2JB396YFB7",
"name": "reactions"
}
]`, dst.String())
}
func TestEmojiCategoriesGetTestSuite(t *testing.T) {