@@ -66,7 +66,7 @@ func TestFileUpload(t *testing.T) {
6666 resp := httptest .NewRecorder ()
6767 h .ServeHTTP (resp , req )
6868 require .Equal (t , http .StatusOK , resp .Code , resp .Body .String ())
69- require .Equal (t , `{"data":{"singleUpload":"test"}}` , resp .Body .String ())
69+ require .JSONEq (t , `{"data":{"singleUpload":"test"}}` , resp .Body .String ())
7070 })
7171
7272 t .Run ("valid single file upload with payload" , func (t * testing.T ) {
@@ -92,7 +92,7 @@ func TestFileUpload(t *testing.T) {
9292 resp := httptest .NewRecorder ()
9393 h .ServeHTTP (resp , req )
9494 require .Equal (t , http .StatusOK , resp .Code , resp .Body .String ())
95- require .Equal (t , `{"data":{"singleUploadWithPayload":"test"}}` , resp .Body .String ())
95+ require .JSONEq (t , `{"data":{"singleUploadWithPayload":"test"}}` , resp .Body .String ())
9696 })
9797
9898 t .Run ("valid file list upload" , func (t * testing.T ) {
@@ -124,7 +124,7 @@ func TestFileUpload(t *testing.T) {
124124 resp := httptest .NewRecorder ()
125125 h .ServeHTTP (resp , req )
126126 require .Equal (t , http .StatusOK , resp .Code , resp .Body .String ())
127- require .Equal (t , `{"data":{"multipleUpload":[{"id":1},{"id":2}]}}` , resp .Body .String ())
127+ require .JSONEq (t , `{"data":{"multipleUpload":[{"id":1},{"id":2}]}}` , resp .Body .String ())
128128 })
129129
130130 t .Run ("valid file list upload with payload" , func (t * testing.T ) {
@@ -156,7 +156,7 @@ func TestFileUpload(t *testing.T) {
156156 resp := httptest .NewRecorder ()
157157 h .ServeHTTP (resp , req )
158158 require .Equal (t , http .StatusOK , resp .Code )
159- require .Equal (t , `{"data":{"multipleUploadWithPayload":[{"id":1},{"id":2}]}}` , resp .Body .String ())
159+ require .JSONEq (t , `{"data":{"multipleUploadWithPayload":[{"id":1},{"id":2}]}}` , resp .Body .String ())
160160 })
161161
162162 t .Run ("valid file list upload with payload and file reuse" , func (t * testing.T ) {
@@ -184,7 +184,7 @@ func TestFileUpload(t *testing.T) {
184184 resp := httptest .NewRecorder ()
185185 h .ServeHTTP (resp , req )
186186 require .Equal (t , http .StatusOK , resp .Code , resp .Body .String ())
187- require .Equal (t , `{"data":{"multipleUploadWithPayload":[{"id":1},{"id":2}]}}` , resp .Body .String ())
187+ require .JSONEq (t , `{"data":{"multipleUploadWithPayload":[{"id":1},{"id":2}]}}` , resp .Body .String ())
188188 }
189189
190190 t .Run ("payload smaller than UploadMaxMemory, stored in memory" , func (t * testing.T ) {
@@ -216,7 +216,7 @@ func TestFileUpload(t *testing.T) {
216216 resp := httptest .NewRecorder ()
217217 h .ServeHTTP (resp , req )
218218 require .Equal (t , http .StatusUnprocessableEntity , resp .Code , resp .Body .String ())
219- require .Equal (t , `{"errors":[{"message":"first part must be operations"}],"data":null}` , resp .Body .String ())
219+ require .JSONEq (t , `{"errors":[{"message":"first part must be operations"}],"data":null}` , resp .Body .String ())
220220 })
221221
222222 t .Run ("fail parse operation" , func (t * testing.T ) {
@@ -226,7 +226,7 @@ func TestFileUpload(t *testing.T) {
226226 resp := httptest .NewRecorder ()
227227 h .ServeHTTP (resp , req )
228228 require .Equal (t , http .StatusUnprocessableEntity , resp .Code , resp .Body .String ())
229- require .Equal (t , `{"errors":[{"message":"operations form field could not be decoded"}],"data":null}` , resp .Body .String ())
229+ require .JSONEq (t , `{"errors":[{"message":"operations form field could not be decoded"}],"data":null}` , resp .Body .String ())
230230 })
231231
232232 t .Run ("fail parse map" , func (t * testing.T ) {
@@ -236,7 +236,7 @@ func TestFileUpload(t *testing.T) {
236236 resp := httptest .NewRecorder ()
237237 h .ServeHTTP (resp , req )
238238 require .Equal (t , http .StatusUnprocessableEntity , resp .Code , resp .Body .String ())
239- require .Equal (t , `{"errors":[{"message":"map form field could not be decoded"}],"data":null}` , resp .Body .String ())
239+ require .JSONEq (t , `{"errors":[{"message":"map form field could not be decoded"}],"data":null}` , resp .Body .String ())
240240 })
241241
242242 t .Run ("fail missing file" , func (t * testing.T ) {
@@ -246,7 +246,7 @@ func TestFileUpload(t *testing.T) {
246246 resp := httptest .NewRecorder ()
247247 h .ServeHTTP (resp , req )
248248 require .Equal (t , http .StatusUnprocessableEntity , resp .Code , resp .Body .String ())
249- require .Equal (t , `{"errors":[{"message":"failed to get key 0 from form"}],"data":null}` , resp .Body .String ())
249+ require .JSONEq (t , `{"errors":[{"message":"failed to get key 0 from form"}],"data":null}` , resp .Body .String ())
250250 })
251251
252252 t .Run ("fail map entry with invalid operations paths prefix" , func (t * testing.T ) {
@@ -256,7 +256,7 @@ func TestFileUpload(t *testing.T) {
256256 resp := httptest .NewRecorder ()
257257 h .ServeHTTP (resp , req )
258258 require .Equal (t , http .StatusUnprocessableEntity , resp .Code , resp .Body .String ())
259- require .Equal (t , `{"errors":[{"message":"invalid operations paths for key 0"}],"data":null}` , resp .Body .String ())
259+ require .JSONEq (t , `{"errors":[{"message":"invalid operations paths for key 0"}],"data":null}` , resp .Body .String ())
260260 })
261261
262262 t .Run ("fail parse request big body" , func (t * testing.T ) {
@@ -266,7 +266,7 @@ func TestFileUpload(t *testing.T) {
266266 resp := httptest .NewRecorder ()
267267 h .ServeHTTP (resp , req )
268268 require .Equal (t , http .StatusOK , resp .Code , resp .Body .String ())
269- require .Equal (t , `{"errors":[{"message":"failed to parse multipart form, request body too large"}],"data":null}` , resp .Body .String ())
269+ require .JSONEq (t , `{"errors":[{"message":"failed to parse multipart form, request body too large"}],"data":null}` , resp .Body .String ())
270270 })
271271}
272272
0 commit comments