@@ -13,8 +13,175 @@ import SkipFirebaseAnalytics
1313let logger : Logger = Logger ( subsystem: " SkipFirebaseAnalyticsTests " , category: " Tests " )
1414
1515@MainActor final class SkipFirebaseAnalyticsTests : XCTestCase {
16- func testSkipFirebaseAnalyticsTests ( ) async throws {
17- Analytics . logEvent ( " x " , parameters : [ " a " : [ 1 , 2 , false ] ] )
16+ func skipTests ( ) throws {
17+ throw XCTSkip ( " test intentionally skipped because it exists just for compiler validation " )
1818 }
19- }
2019
20+ func testLogEvent( ) throws {
21+ try skipTests ( )
22+
23+ let params : [ String : Any ] = [
24+ AnalyticsParameterItemName: " test_item " ,
25+ AnalyticsParameterPrice: 9.99 ,
26+ AnalyticsParameterQuantity: 1 ,
27+ AnalyticsParameterCurrency: " USD "
28+ ]
29+ Analytics . logEvent ( " ABC " , parameters: params)
30+ }
31+
32+ func testSetUserProperty( ) throws {
33+ try skipTests ( )
34+
35+ Analytics . setUserProperty ( " X " , forName: " Y " )
36+ Analytics . setUserProperty ( nil , forName: " Y " )
37+ }
38+
39+ func testSetUserID( ) throws {
40+ try skipTests ( )
41+
42+ Analytics . setUserID ( nil )
43+ Analytics . setUserID ( " ABC " )
44+ }
45+
46+ func testSetAnalyticsCollectionEnabled( ) throws {
47+ try skipTests ( )
48+
49+ Analytics . setAnalyticsCollectionEnabled ( false )
50+ }
51+
52+ func testSetDefaultEventParameters( ) throws {
53+ try skipTests ( )
54+
55+ Analytics . setDefaultEventParameters ( nil )
56+ Analytics . setDefaultEventParameters ( [ " x " : false ] )
57+ }
58+
59+ func testResetAnalyticsData( ) throws {
60+ try skipTests ( )
61+
62+ Analytics . resetAnalyticsData ( )
63+ }
64+
65+ func testAppInstanceID( ) throws {
66+ try skipTests ( )
67+
68+ let _: String ? = Analytics . appInstanceID ( )
69+ }
70+
71+ func testSessionID( ) async throws {
72+ try skipTests ( )
73+
74+ let _: Int64 ? = try await Analytics . sessionID ( )
75+ }
76+
77+ func testSetSessionTimeoutInterval( ) throws {
78+ try skipTests ( )
79+
80+ Analytics . setSessionTimeoutInterval ( TimeInterval ( 100.0 ) )
81+ }
82+
83+ func testConsentTypes( ) throws {
84+ try skipTests ( )
85+
86+ // Verify ConsentType static members exist and are the right type
87+ let _: ConsentType = . adPersonalization
88+ let _: ConsentType = . adStorage
89+ let _: ConsentType = . adUserData
90+ let _: ConsentType = . analyticsStorage
91+ }
92+
93+ func testConsentStatus( ) throws {
94+ try skipTests ( )
95+
96+ // Verify ConsentStatus static members exist and are the right type
97+ let _: ConsentStatus = . granted
98+ let _: ConsentStatus = . denied
99+ }
100+
101+ func testSetConsent( ) throws {
102+ try skipTests ( )
103+
104+ Analytics . setConsent ( [
105+ . analyticsStorage: . granted,
106+ . adPersonalization: . denied
107+ ] )
108+ }
109+
110+ func testEventNameConstants( ) throws {
111+ try skipTests ( )
112+
113+ // Verify event name constants exist and are strings
114+ let events : [ String ] = [
115+ AnalyticsEventAdImpression,
116+ AnalyticsEventAddPaymentInfo,
117+ AnalyticsEventAddShippingInfo,
118+ AnalyticsEventAddToCart,
119+ AnalyticsEventAddToWishlist,
120+ AnalyticsEventAppOpen,
121+ AnalyticsEventBeginCheckout,
122+ AnalyticsEventCampaignDetails,
123+ AnalyticsEventEarnVirtualCurrency,
124+ AnalyticsEventGenerateLead,
125+ AnalyticsEventJoinGroup,
126+ AnalyticsEventLevelEnd,
127+ AnalyticsEventLevelStart,
128+ AnalyticsEventLevelUp,
129+ AnalyticsEventLogin,
130+ AnalyticsEventPostScore,
131+ AnalyticsEventPurchase,
132+ AnalyticsEventRefund,
133+ AnalyticsEventRemoveFromCart,
134+ AnalyticsEventScreenView,
135+ AnalyticsEventSearch,
136+ AnalyticsEventSelectContent,
137+ AnalyticsEventSelectItem,
138+ AnalyticsEventSelectPromotion,
139+ AnalyticsEventShare,
140+ AnalyticsEventSignUp,
141+ AnalyticsEventSpendVirtualCurrency,
142+ AnalyticsEventTutorialBegin,
143+ AnalyticsEventTutorialComplete,
144+ AnalyticsEventUnlockAchievement,
145+ AnalyticsEventViewCart,
146+ AnalyticsEventViewItem,
147+ AnalyticsEventViewItemList,
148+ AnalyticsEventViewPromotion,
149+ AnalyticsEventViewSearchResults,
150+ ]
151+ XCTAssertFalse ( events. isEmpty)
152+ }
153+
154+ func testParameterNameConstants( ) throws {
155+ try skipTests ( )
156+
157+ // Verify a representative set of parameter constants exist and are strings
158+ let params : [ String ] = [
159+ AnalyticsParameterItemName,
160+ AnalyticsParameterItemID,
161+ AnalyticsParameterPrice,
162+ AnalyticsParameterQuantity,
163+ AnalyticsParameterCurrency,
164+ AnalyticsParameterValue,
165+ AnalyticsParameterScreenName,
166+ AnalyticsParameterScreenClass,
167+ AnalyticsParameterSearchTerm,
168+ AnalyticsParameterMethod,
169+ AnalyticsParameterScore,
170+ AnalyticsParameterLevel,
171+ AnalyticsParameterContent,
172+ AnalyticsParameterContentType,
173+ AnalyticsParameterCoupon,
174+ AnalyticsParameterTransactionID,
175+ AnalyticsParameterShipping,
176+ AnalyticsParameterTax,
177+ ]
178+ XCTAssertFalse ( params. isEmpty)
179+ }
180+
181+ func testUserPropertyConstants( ) throws {
182+ try skipTests ( )
183+
184+ let _: String = AnalyticsUserPropertyAllowAdPersonalizationSignals
185+ let _: String = AnalyticsUserPropertySignUpMethod
186+ }
187+ }
0 commit comments