Skip to content

Commit

Permalink
add test coverage for json unmarshal
Browse files Browse the repository at this point in the history
  • Loading branch information
leamarty committed Jan 23, 2025
1 parent 7c0f3cf commit 4fefda1
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
4 changes: 2 additions & 2 deletions adapters/smoot/smoot.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E
adapterRequests = append(adapterRequests, adapterReq)
}

return adapterRequests, nil
return adapterRequests, errs
}

func (a *adapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestData, error) {
Expand All @@ -93,7 +93,7 @@ func (a *adapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestDa
headers.Add("Content-Type", "application/json;charset=utf-8")
headers.Add("Accept", "application/json")
return &adapters.RequestData{
Method: "POST",
Method: http.MethodPost,
Uri: a.endpoint,
Body: reqJSON,
Headers: headers,
Expand Down
19 changes: 19 additions & 0 deletions adapters/smoot/smoottest/supplemental/invalid-bidder.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"ext": {
"bidder": 999
}
}
]
},
"expectedMakeRequestsErrors": [
{
"value": "expect { or n, but found 9",
"comparison": "literal"
}
]
}
17 changes: 17 additions & 0 deletions adapters/smoot/smoottest/supplemental/invalid-ext.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"ext": 123
}
]
},
"expectedMakeRequestsErrors": [
{
"value": "expect { or n, but found 1",
"comparison": "literal"
}
]
}

0 comments on commit 4fefda1

Please sign in to comment.