github.com/prebid/prebid-server@v0.275.0/analytics/pubstack/helpers/json_test.go (about) 1 package helpers 2 3 import ( 4 "net/http" 5 "testing" 6 7 "github.com/prebid/openrtb/v19/openrtb2" 8 "github.com/prebid/prebid-server/analytics" 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestJsonifyAuctionObject(t *testing.T) { 13 ao := &analytics.AuctionObject{ 14 Status: http.StatusOK, 15 } 16 17 _, err := JsonifyAuctionObject(ao, "scopeId") 18 assert.NoError(t, err) 19 } 20 21 func TestJsonifyVideoObject(t *testing.T) { 22 vo := &analytics.VideoObject{ 23 Status: http.StatusOK, 24 } 25 26 _, err := JsonifyVideoObject(vo, "scopeId") 27 assert.NoError(t, err) 28 } 29 30 func TestJsonifyCookieSync(t *testing.T) { 31 cso := &analytics.CookieSyncObject{ 32 Status: http.StatusOK, 33 BidderStatus: []*analytics.CookieSyncBidder{}, 34 } 35 36 _, err := JsonifyCookieSync(cso, "scopeId") 37 assert.NoError(t, err) 38 } 39 40 func TestJsonifySetUIDObject(t *testing.T) { 41 so := &analytics.SetUIDObject{ 42 Status: http.StatusOK, 43 Bidder: "any-bidder", 44 UID: "uid string", 45 } 46 47 _, err := JsonifySetUIDObject(so, "scopeId") 48 assert.NoError(t, err) 49 } 50 51 func TestJsonifyAmpObject(t *testing.T) { 52 ao := &analytics.AmpObject{ 53 Status: http.StatusOK, 54 Errors: make([]error, 0), 55 AuctionResponse: &openrtb2.BidResponse{}, 56 AmpTargetingValues: map[string]string{}, 57 } 58 59 _, err := JsonifyAmpObject(ao, "scopeId") 60 assert.NoError(t, err) 61 }