Skip to content

Commit

Permalink
Merge pull request cloudflare#691 from favonia/improve-zone-test
Browse files Browse the repository at this point in the history
test(zone): refactor testing of zone.go
  • Loading branch information
jacobbednarz authored Aug 15, 2021
2 parents b24251b + e8fa176 commit b85431c
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions zone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1384,16 +1384,9 @@ func TestListZones(t *testing.T) {
count = total - start
}

res, err := json.Marshal(mockZonesResponse(total, page, start, count))
if !assert.NoError(t, err) {
return
}

w.Header().Set("content-type", "application/json")

if _, err = w.Write(res); assert.NoError(t, err) {
return
}
err := json.NewEncoder(w).Encode(mockZonesResponse(total, page, start, count))
assert.NoError(t, err)
}

mux.HandleFunc("/zones", handler)
Expand Down Expand Up @@ -1443,16 +1436,9 @@ func TestListZonesFailingPages(t *testing.T) {
count = total - start
}

res, err := json.Marshal(mockZonesResponse(total, page, start, count))
if !assert.NoError(t, err) {
return
}

w.Header().Set("content-type", "application/json")

if _, err = w.Write(res); assert.NoError(t, err) {
return
}
err := json.NewEncoder(w).Encode(mockZonesResponse(total, page, start, count))
assert.NoError(t, err)
}

mux.HandleFunc("/zones", handler)
Expand Down

0 comments on commit b85431c

Please sign in to comment.