-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b0f6d6
commit 52ec34c
Showing
2 changed files
with
169 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
Packages/KeyAppKit/Tests/UnitTests/AnalyticsManagerUnitTests/ProvidersTest.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import Foundation | ||
import XCTest | ||
@testable import AnalyticsManager | ||
|
||
class ProvidersTests: XCTestCase { | ||
func testKeyAppAnalytics_GiveDefaultEvents_ShouldReturnAmplitudeProviderId() { | ||
// Test case for events with only the default provider (Amplitude) | ||
let eventsWithDefaultProvider: [KeyAppAnalyticsEvent] = [ | ||
.createPhoneClickButton, | ||
.restorePhoneClickButton, | ||
] | ||
let defaultProviderIds: Set<String> = [KeyAppAnalyticsProviderId.amplitude.rawValue] | ||
let defaultProviderIdsResult = eventsWithDefaultProvider.flatMap(\.providerIds) | ||
XCTAssertEqual(Set(defaultProviderIdsResult), defaultProviderIds) | ||
} | ||
|
||
func testKeyAppAnalytics_GiveSpecialEvents_ShouldReturnAdditionalProviderIds() { | ||
// Test case for events with additional providers (AppsFlyer and Firebase Analytics) | ||
let eventsWithAdditionalProviders: [KeyAppAnalyticsEvent] = [ | ||
.onboardingStartButton, | ||
.creationPhoneScreen, | ||
.createSmsValidation(result: true), | ||
.createConfirmPin(result: true), | ||
.usernameCreationScreen, | ||
.usernameCreationButton(result: true), | ||
.restoreSeed, | ||
.onboardingMerged, | ||
.login, | ||
.buyButtonPressed( | ||
sumCurrency: "", | ||
sumCoin: "", | ||
currency: "", | ||
coin: "", | ||
paymentMethod: "", | ||
bankTransfer: true, | ||
typeBankTransfer: "" | ||
), | ||
.sendNewConfirmButtonClick( | ||
sendFlow: "", | ||
token: "", | ||
max: true, | ||
amountToken: 0, | ||
amountUSD: 0, | ||
fee: true, | ||
fiatInput: true, | ||
signature: "", | ||
pubKey: "" | ||
), | ||
.swapClickApproveButton, | ||
] | ||
let additionalProviderIds: Set<String> = [ | ||
KeyAppAnalyticsProviderId.amplitude.rawValue, | ||
KeyAppAnalyticsProviderId.appsFlyer.rawValue, | ||
KeyAppAnalyticsProviderId.firebaseAnalytics.rawValue, | ||
] | ||
let additionalProviderIdsResult = eventsWithAdditionalProviders.flatMap(\.providerIds) | ||
XCTAssertEqual(Set(additionalProviderIdsResult), additionalProviderIds) | ||
} | ||
} |