Bump posthog SDK version to 3.2.0 (#2788)

Co-authored-by: Mauro <34335419+Velin92@users.noreply.github.com>
This commit is contained in:
Valere
2024-05-06 17:07:05 +02:00
committed by GitHub
parent 1aa1174e9d
commit 6d2c4d87ed
10 changed files with 91 additions and 60 deletions

View File

@@ -265,4 +265,38 @@ class AnalyticsTests: XCTestCase {
XCTAssertEqual(capturedEvent2?.properties?["appPlatform"] as? String, "A thing")
XCTAssertEqual(capturedEvent2?.properties?["cryptoSDKVersion"] as? String, "001")
}
func testShouldNotReportIfNotStarted() {
// Given a client with user properties set
let client = PostHogAnalyticsClient(posthogFactory: MockPostHogFactory(mock: posthogMock))
// No call to start
client.screen(AnalyticsEvent.MobileScreen(durationMs: nil, screenName: .Home))
XCTAssertEqual(posthogMock.screenPropertiesCalled, false)
// It should be the same for any event
let someEvent = AnalyticsEvent.Error(context: nil,
cryptoModule: .Rust,
cryptoSDK: .Rust,
domain: .E2EE,
eventLocalAgeMillis: nil,
isFederated: nil,
isMatrixDotOrg: nil,
name: .OlmKeysNotSentError,
timeToDecryptMillis: nil,
userTrustsOwnIdentity: nil,
wasVisibleToUser: nil)
client.capture(someEvent)
XCTAssertEqual(posthogMock.capturePropertiesCalled, false)
// start now
client.start(analyticsConfiguration: appSettings.analyticsConfiguration)
XCTAssertEqual(posthogMock.optInCalled, true)
client.capture(someEvent)
XCTAssertEqual(posthogMock.capturePropertiesCalled, true)
}
}