Skip to content

Commit

Permalink
style(aduptech): small code formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
danygielow committed Jan 16, 2025
1 parent 1dc4b16 commit ec665c1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
28 changes: 24 additions & 4 deletions adapters/aduptech/aduptech_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,37 @@ import (
)

func TestJsonSamples(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderAdUpTech, config.Adapter{
Endpoint: "https://example.com/rtb/bid", ExtraAdapterInfo: "{\"target_currency\": \"EUR\"}"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})
bidder, buildErr := Builder(
openrtb_ext.BidderAdUpTech,
config.Adapter{
Endpoint: "https://example.com/rtb/bid",
ExtraAdapterInfo: `{"target_currency": "EUR"}`,
},
config.Server{
ExternalUrl: "http://hosturl.com",
GvlID: 1,
DataCenter: "2",
},
)

require.NoError(t, buildErr, "Builder returned unexpected error")

adapterstest.RunJSONBidderTest(t, "aduptechtest", bidder)
}

func TestInvalidExtraAdapterInfo(t *testing.T) {
_, buildErr := Builder(openrtb_ext.BidderAdUpTech, config.Adapter{
Endpoint: "https://example.com/rtb/bid", ExtraAdapterInfo: "{\"foo\": \"bar\"}"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})
_, buildErr := Builder(
openrtb_ext.BidderAdUpTech,
config.Adapter{
Endpoint: "https://example.com/rtb/bid",
ExtraAdapterInfo: `{"foo": "bar"}`,
},
config.Server{
ExternalUrl: "http://hosturl.com",
GvlID: 1,
DataCenter: "2",
},
)

assert.EqualError(t, buildErr, "invalid extra info: TargetCurrency is empty, pls check")
}
14 changes: 12 additions & 2 deletions adapters/aduptech/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ func TestValidParams(t *testing.T) {
}

for _, validParam := range validParams {
assert.NoErrorf(t, validator.Validate(openrtb_ext.BidderAdUpTech, json.RawMessage(validParam)), "Schema rejected Aduptech params: %s", validParam)
assert.NoErrorf(
t,
validator.Validate(openrtb_ext.BidderAdUpTech, json.RawMessage(validParam)),
"Schema rejected Aduptech params: %s",
validParam,
)
}
}

Expand Down Expand Up @@ -56,6 +61,11 @@ func TestInvalidParams(t *testing.T) {
}

for _, invalidParam := range invalidParams {
assert.Errorf(t, validator.Validate(openrtb_ext.BidderAdUpTech, json.RawMessage(invalidParam)), "Schema allowed unexpected params: %s", invalidParam)
assert.Errorf(
t,
validator.Validate(openrtb_ext.BidderAdUpTech, json.RawMessage(invalidParam)),
"Schema allowed unexpected params: %s",
invalidParam,
)
}
}

0 comments on commit ec665c1

Please sign in to comment.