Skip to content

Commit fe9b0ef

Browse files
committed
Update testing error logging in JSON unmarshal tests to use %v instead of %w
1 parent e794b60 commit fe9b0ef

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

internal/delivery/http/route_boards_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestGetPopularBoardList(t *testing.T) {
3333
responseMap := map[string]interface{}{}
3434
err = json.Unmarshal(rr.Body.Bytes(), &responseMap)
3535
if err != nil {
36-
t.Errorf("get unexpect json: %w", err)
36+
t.Errorf("get unexpect json: %v", err)
3737
}
3838
t.Logf("got response %v", rr.Body.String())
3939
responseData := responseMap["data"]
@@ -86,7 +86,7 @@ func TestGetBoardList(t *testing.T) {
8686
actualResponseMap := map[string]interface{}{}
8787
err = json.Unmarshal(w.Body.Bytes(), &actualResponseMap)
8888
if err != nil {
89-
t.Errorf("get unexpect json: %w", err)
89+
t.Errorf("get unexpect json: %v", err)
9090
}
9191
t.Logf("got response %v", w.Body.String())
9292
actualResponseDataList := actualResponseMap["data"].([]interface{})
@@ -140,7 +140,7 @@ func TestGetBoardInformation(t *testing.T) {
140140
actualResponseMap := map[string]interface{}{}
141141
err = json.Unmarshal(w.Body.Bytes(), &actualResponseMap)
142142
if err != nil {
143-
t.Errorf("get unexpect json: %w", err)
143+
t.Errorf("get unexpect json: %v", err)
144144
}
145145
t.Logf("got response %v", w.Body.String())
146146
actualResponseData := actualResponseMap["data"].(map[string]interface{})
@@ -193,7 +193,7 @@ func TestGetBoardSettings(t *testing.T) {
193193
actualResponseMap := map[string]interface{}{}
194194
err = json.Unmarshal(w.Body.Bytes(), &actualResponseMap)
195195
if err != nil {
196-
t.Errorf("get unexpect json: %w", err)
196+
t.Errorf("get unexpect json: %v", err)
197197
}
198198
t.Logf("got response %v", w.Body.String())
199199
}

internal/delivery/http/route_classes_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func TestGetClassesList(t *testing.T) {
3434
responseMap := map[string][]interface{}{}
3535
err = json.Unmarshal(rr.Body.Bytes(), &responseMap)
3636
if err != nil {
37-
t.Errorf("get unexpect json: %w", err)
37+
t.Errorf("get unexpect json: %v", err)
3838
}
3939

4040
t.Logf("got response %v", rr.Body.String())

internal/delivery/http/route_popular_articles_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestGetPopularArticles(t *testing.T) {
2828
responseMap := map[string]interface{}{}
2929
err = json.Unmarshal(rr.Body.Bytes(), &responseMap)
3030
if err != nil {
31-
t.Errorf("get unexpect json: %w", err)
31+
t.Errorf("get unexpect json: %v", err)
3232
}
3333
t.Logf("got response %v", rr.Body.String())
3434
}

internal/delivery/http/route_token_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestPostToken(t *testing.T) {
3636
responsedMap := map[string]interface{}{}
3737
err = json.Unmarshal(rr.Body.Bytes(), &responsedMap)
3838
if err != nil {
39-
t.Errorf("get unexpect json: %w", err)
39+
t.Errorf("get unexpect json: %v", err)
4040
}
4141
t.Logf("got response %v", rr.Body.String())
4242

@@ -74,7 +74,7 @@ func TestPostTokenFormEmpty(t *testing.T) {
7474
responsedMap := map[string]interface{}{}
7575
err = json.Unmarshal(rr.Body.Bytes(), &responsedMap)
7676
if err != nil {
77-
t.Errorf("get unexpect json: %w", err)
77+
t.Errorf("get unexpect json: %v", err)
7878
}
7979
t.Logf("got response %v", rr.Body.String())
8080

internal/delivery/http/route_users_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func TestGetUserInformation(t *testing.T) {
5656
responsedMap := map[string]interface{}{}
5757
err = json.Unmarshal(rr.Body.Bytes(), &responsedMap)
5858
if err != nil {
59-
t.Errorf("get unexpect json: %w", err)
59+
t.Errorf("get unexpect json: %v", err)
6060
}
6161

6262
t.Logf("got response %v", rr.Body.String())
@@ -155,7 +155,7 @@ func TestGetUserFavorite(t *testing.T) {
155155
responsedMap := map[string]interface{}{}
156156
err = json.Unmarshal(rr.Body.Bytes(), &responsedMap)
157157
if err != nil {
158-
t.Errorf("get unexpect json: %w", err)
158+
t.Errorf("get unexpect json: %v", err)
159159
}
160160

161161
t.Logf("got response %v", rr.Body.String())
@@ -196,7 +196,7 @@ func TestGetUserPreference(t *testing.T) {
196196
responsedMap := map[string]interface{}{}
197197
err = json.Unmarshal(rr.Body.Bytes(), &responsedMap)
198198
if err != nil {
199-
t.Errorf("get unexpected json: %w", err)
199+
t.Errorf("get unexpected json: %v", err)
200200
}
201201

202202
t.Logf("got response %v", rr.Body.String())
@@ -238,7 +238,7 @@ func TestGetUserArticles(t *testing.T) {
238238
responsedMap := map[string]interface{}{}
239239
err = json.Unmarshal(rr.Body.Bytes(), &responsedMap)
240240
if err != nil {
241-
t.Errorf("get unexpect json: %w", err)
241+
t.Errorf("get unexpect json: %v", err)
242242
}
243243
t.Logf("got response %v", rr.Body.String())
244244
if responsedMap["data"] == nil {
@@ -275,7 +275,7 @@ func TestGetUserComments(t *testing.T) {
275275
responsedMap := map[string]interface{}{}
276276
err = json.Unmarshal(rr.Body.Bytes(), &responsedMap)
277277
if err != nil {
278-
t.Errorf("get unexpect json: %w", err)
278+
t.Errorf("get unexpect json: %v", err)
279279
}
280280
}
281281

@@ -307,7 +307,7 @@ func TestGetUserDrafts(t *testing.T) {
307307
responsedMap := map[string]interface{}{}
308308
err = json.Unmarshal(rr.Body.Bytes(), &responsedMap)
309309
if err != nil {
310-
t.Errorf("get unexpect json: %w", err)
310+
t.Errorf("get unexpect json: %v", err)
311311
}
312312

313313
t.Logf("got response %v", rr.Body.String())
@@ -354,7 +354,7 @@ func TestUpdateUserDraft(t *testing.T) {
354354
responsedMap := map[string]interface{}{}
355355
err = json.Unmarshal(rr.Body.Bytes(), &responsedMap)
356356
if err != nil {
357-
t.Errorf("get unexpect json: %w", err)
357+
t.Errorf("get unexpect json: %v", err)
358358
}
359359

360360
t.Logf("got response %v", rr.Body.String())

0 commit comments

Comments
 (0)