(t *testing.T)
| 43 | } |
| 44 | |
| 45 | func TestAnalyticsTrackImpression(t *testing.T) { |
| 46 | ctx := context.Background() |
| 47 | client, requester := newClient(t) |
| 48 | analytics := client.Analytics() |
| 49 | imp := stream.ImpressionEventsData{}. |
| 50 | WithForeignIDs("a", "b", "c", "d"). |
| 51 | WithUserData(stream.NewUserData().Int(123)). |
| 52 | WithFeedID("timeline:123"). |
| 53 | WithFeatures( |
| 54 | stream.NewEventFeature("color", "red"), |
| 55 | stream.NewEventFeature("size", "xxl"), |
| 56 | ). |
| 57 | WithLocation("hawaii"). |
| 58 | WithPosition(42) |
| 59 | |
| 60 | _, err := analytics.TrackImpression(ctx, imp) |
| 61 | require.NoError(t, err) |
| 62 | expectedURL := "https://analytics.stream-io-api.com/analytics/v1.0/impression/?api_key=key" |
| 63 | expectedBody := `{"content_list":["a","b","c","d"],"features":[{"group":"color","value":"red"},{"group":"size","value":"xxl"}],"feed_id":"timeline:123","location":"hawaii","position":42,"user_data":123}` |
| 64 | testRequest(t, requester.req, http.MethodPost, expectedURL, expectedBody) |
| 65 | } |
| 66 | |
| 67 | func TestAnalyticsRedirectAndTrack(t *testing.T) { |
| 68 | client, _ := newClient(t) |
nothing calls this directly
no test coverage detected