1
1
use primitives:: {
2
- analytics:: { AnalyticsQuery , Metric , Timeframe , query:: { AllowedKey , Time } , OperatingSystem } ,
3
- sentry:: { EventType , DateHour } ,
4
- Address , CampaignId , ChainId , IPFS
2
+ analytics:: {
3
+ query:: { AllowedKey , Time } ,
4
+ AnalyticsQuery , Metric , OperatingSystem , Timeframe ,
5
+ } ,
6
+ sentry:: { DateHour , EventType } ,
7
+ Address , CampaignId , ChainId , IPFS ,
5
8
} ;
6
9
use std:: str:: FromStr ;
7
10
@@ -61,20 +64,56 @@ fn main() {
61
64
assert_eq ! ( query. event_type, EventType :: Click ) ;
62
65
assert ! ( matches!( query. metric, Metric :: Paid ) ) ;
63
66
assert_eq ! ( query. segment_by, Some ( AllowedKey :: Country ) ) ;
64
- assert_eq ! ( query. time, Time {
65
- timeframe: Timeframe :: Week ,
66
- start: DateHour :: from_ymdh( 2021 , 12 , 31 , 22 ) ,
67
- end: None ,
68
- } ) ;
69
- assert_eq ! ( query. campaign_id, Some ( CampaignId :: from_str( "0x936da01f9abd4d9d80c702af85c822a8" ) . expect( "should be valid" ) ) ) ;
70
- assert_eq ! ( query. ad_unit, Some ( IPFS :: from_str( "Qmasg8FrbuSQpjFu3kRnZF9beg8rEBFrqgi1uXDRwCbX5f" ) . expect( "should be valid" ) ) ) ;
71
- assert_eq ! ( query. ad_slot, Some ( IPFS :: from_str( "QmcUVX7fvoLMM93uN2bD3wGTH8MXSxeL8hojYfL2Lhp7mR" ) . expect( "should be valid" ) ) ) ;
67
+ assert_eq ! (
68
+ query. time,
69
+ Time {
70
+ timeframe: Timeframe :: Week ,
71
+ start: DateHour :: from_ymdh( 2021 , 12 , 31 , 22 ) ,
72
+ end: None ,
73
+ }
74
+ ) ;
75
+ assert_eq ! (
76
+ query. campaign_id,
77
+ Some (
78
+ CampaignId :: from_str( "0x936da01f9abd4d9d80c702af85c822a8" )
79
+ . expect( "should be valid" )
80
+ )
81
+ ) ;
82
+ assert_eq ! (
83
+ query. ad_unit,
84
+ Some (
85
+ IPFS :: from_str( "Qmasg8FrbuSQpjFu3kRnZF9beg8rEBFrqgi1uXDRwCbX5f" )
86
+ . expect( "should be valid" )
87
+ )
88
+ ) ;
89
+ assert_eq ! (
90
+ query. ad_slot,
91
+ Some (
92
+ IPFS :: from_str( "QmcUVX7fvoLMM93uN2bD3wGTH8MXSxeL8hojYfL2Lhp7mR" )
93
+ . expect( "should be valid" )
94
+ )
95
+ ) ;
72
96
assert_eq ! ( query. ad_slot_type, Some ( "legacy_300x100" . to_string( ) ) ) ;
73
- assert_eq ! ( query. advertiser, Some ( Address :: from_str( "0xDd589B43793934EF6Ad266067A0d1D4896b0dff0" ) . expect( "should be valid" ) ) ) ;
74
- assert_eq ! ( query. publisher, Some ( Address :: from_str( "0xE882ebF439207a70dDcCb39E13CA8506c9F45fD9" ) . expect( "should be valid" ) ) ) ;
97
+ assert_eq ! (
98
+ query. advertiser,
99
+ Some (
100
+ Address :: from_str( "0xDd589B43793934EF6Ad266067A0d1D4896b0dff0" )
101
+ . expect( "should be valid" )
102
+ )
103
+ ) ;
104
+ assert_eq ! (
105
+ query. publisher,
106
+ Some (
107
+ Address :: from_str( "0xE882ebF439207a70dDcCb39E13CA8506c9F45fD9" )
108
+ . expect( "should be valid" )
109
+ )
110
+ ) ;
75
111
assert_eq ! ( query. hostname, Some ( "localhost" . to_string( ) ) ) ;
76
112
assert_eq ! ( query. country, Some ( "Bulgaria" . to_string( ) ) ) ;
77
- assert_eq ! ( query. os_name, Some ( OperatingSystem :: Whitelisted ( "Windows" . to_string( ) ) ) ) ;
113
+ assert_eq ! (
114
+ query. os_name,
115
+ Some ( OperatingSystem :: Whitelisted ( "Windows" . to_string( ) ) )
116
+ ) ;
78
117
assert_eq ! ( query. chains, vec!( ChainId :: new( 1 ) , ChainId :: new( 1337 ) ) ) ;
79
118
}
80
- }
119
+ }
0 commit comments