diff --git a/exchange/events_test.go b/exchange/events_test.go index 5f24676a534..bb1f48680fb 100644 --- a/exchange/events_test.go +++ b/exchange/events_test.go @@ -305,6 +305,26 @@ func TestAppendURLs(t *testing.T) { defaultURL string expectedURLs []string }{ + { + name: "urls is nil", + urls: nil, + event: config.VASTEvent{ + URLs: []string{}, + ExcludeDefaultURL: false, + }, + defaultURL: "http://default.url", + expectedURLs: []string{"http://default.url"}, + }, + { + name: "events.url is nil", + urls: []string{}, + event: config.VASTEvent{ + URLs: nil, + ExcludeDefaultURL: false, + }, + defaultURL: "http://default.url", + expectedURLs: []string{"http://default.url"}, + }, { name: "No URLs in event, include default URL", urls: []string{}, @@ -480,6 +500,41 @@ func TestModifyBidVAST(t *testing.T) { }, }, }, + { + name: "Video bid type with AdM with generatedBIdID set", + ev: &eventTracking{ + externalURL: "http://example.com", + accountID: "account1", + auctionTimestampMs: 1234567890, + integrationType: "integration1", + macroProvider: macros.NewProvider(&openrtb_ext.RequestWrapper{ + BidRequest: &openrtb2.BidRequest{}, + }), + events: injector.VASTEvents{ + TrackingEvents: make(map[string][]string), + CompanionClickThrough: []string{"http://tracking.url", "http://default.url"}, + }, + }, + pbsBid: &entities.PbsOrtbBid{ + BidType: openrtb_ext.BidTypeVideo, + Bid: &openrtb2.Bid{ + ID: "bid2", + NURL: "http://nurl.com", + AdM: `iabtechlabhttp://example.com/errorhttp://example.com/track/impression`, + }, + GeneratedBidID: "generatedBidID", + }, + bidderName: "bidder2", + expectedPbsBid: &entities.PbsOrtbBid{ + BidType: openrtb_ext.BidTypeVideo, + Bid: &openrtb2.Bid{ + ID: "bid2", + NURL: "http://nurl.com", + AdM: "", + }, + GeneratedBidID: "generatedBidID", + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {