Skip to content

Commit 3c2a5ef

Browse files
liranliran
authored andcommitted
fix: Complete httpexpect deprecated method replacements
- Replace all ValueEqual -> HasValue (including line-start occurrences) - Replace all ContentType -> HasContentType - All httpexpect tests passing
1 parent 0a443ca commit 3c2a5ef

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

11_httpexpect/api_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func TestHealthEndpoint(t *testing.T) {
100100
Expect().
101101
Status(http.StatusOK).
102102
JSON().Object().
103-
ValueEqual("status", "healthy")
103+
HasValue("status", "healthy")
104104
}
105105

106106
// TestListUsers demonstrates testing a list endpoint.
@@ -114,22 +114,22 @@ func TestListUsers(t *testing.T) {
114114
obj := e.GET("/users").
115115
Expect().
116116
Status(http.StatusOK).
117-
ContentType("application/json").
117+
HasContentType("application/json").
118118
JSON().Array()
119119

120120
// Verify array length
121121
obj.Length().IsEqual(2)
122122

123123
// Verify first user
124124
obj.Value(0).Object().
125-
ValueEqual("id", 1).
126-
ValueEqual("name", "John Doe").
127-
ValueEqual("email", "john@example.com")
125+
HasValue("id", 1).
126+
HasValue("name", "John Doe").
127+
HasValue("email", "john@example.com")
128128

129129
// Verify second user
130130
obj.Value(1).Object().
131-
ValueEqual("id", 2).
132-
ValueEqual("name", "Jane Smith")
131+
HasValue("id", 2).
132+
HasValue("name", "Jane Smith")
133133
}
134134

135135
// TestGetUser demonstrates testing a specific resource endpoint.
@@ -213,7 +213,7 @@ func TestWithHandler(t *testing.T) {
213213
Expect().
214214
Status(http.StatusOK).
215215
JSON().Object().
216-
ValueEqual("status", "healthy")
216+
HasValue("status", "healthy")
217217
}
218218

219219
// TestJSONAssertions demonstrates various JSON assertion methods.
@@ -250,8 +250,8 @@ func TestJSONAssertions(t *testing.T) {
250250

251251
// Test nested objects
252252
obj.Value("address").Object().
253-
ValueEqual("city", "New York").
254-
ValueEqual("country", "USA")
253+
HasValue("city", "New York").
254+
HasValue("country", "USA")
255255

256256
// Test arrays
257257
tags := obj.Value("tags").Array()
@@ -341,8 +341,8 @@ func TestQueryParameters(t *testing.T) {
341341
Expect().
342342
Status(http.StatusOK).
343343
JSON().Object().
344-
ValueEqual("filter", "active").
345-
ValueEqual("limit", "10")
344+
HasValue("filter", "active").
345+
HasValue("limit", "10")
346346
}
347347

348348
// TestChainedRequests demonstrates making multiple related requests.
@@ -370,5 +370,5 @@ func TestChainedRequests(t *testing.T) {
370370
Expect().
371371
Status(http.StatusOK).
372372
JSON().Object().
373-
ValueEqual("name", "John Doe")
373+
HasValue("name", "John Doe")
374374
}

0 commit comments

Comments
 (0)