@@ -229,14 +229,32 @@ mod test {
229
229
assert_eq ! ( UnifiedNum :: from_u64( 1_000_000 ) , analytics. payout_amount) ;
230
230
assert_eq ! ( 1 , analytics. payout_count) ;
231
231
232
- let analytics_updated = update_analytics ( & database. clone ( ) , update. clone ( ) )
232
+ let new_update = UpdateAnalytics {
233
+ time : DateHour :: from_ymdh ( 2021 , 2 , 1 , 1 ) ,
234
+ campaign_id : DUMMY_CAMPAIGN . id ,
235
+ ad_unit : ad_unit. ipfs ,
236
+ ad_slot : ad_slot_ipfs,
237
+ ad_slot_type : Some ( ad_unit. ad_type . clone ( ) ) ,
238
+ advertiser : * CREATOR ,
239
+ publisher : * PUBLISHER ,
240
+ hostname : Some ( "localhost" . to_string ( ) ) ,
241
+ country : Some ( "Bulgaria" . to_string ( ) ) ,
242
+ os_name : OperatingSystem :: Linux ,
243
+ chain_id : ChainId :: new ( 1 ) ,
244
+ event_type : IMPRESSION ,
245
+ amount_to_add : UnifiedNum :: from_u64 ( 1_000_000 ) ,
246
+ count_to_add : 69 ,
247
+ } ;
248
+
249
+ let analytics_updated = update_analytics ( & database. clone ( ) , new_update. clone ( ) )
233
250
. await
234
251
. expect ( "Should update" ) ;
252
+
235
253
assert_eq ! (
236
254
analytics_updated. payout_amount,
237
255
UnifiedNum :: from_u64( 2_000_000 )
238
256
) ;
239
- assert_eq ! ( analytics_updated. payout_count, 2 ) ;
257
+ assert_eq ! ( analytics_updated. payout_count, 70 ) ;
240
258
}
241
259
242
260
// On empty fields marked as `NOT NULL` it should successfully insert a new analytics
0 commit comments