Skip to content

Commit

Permalink
Fix tests for non-iOS platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrenskers committed Nov 29, 2022
1 parent 6973d8f commit 51f6f0e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/Sentry/SentrySDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,11 @@ + (void)close
}
[hub removeAllIntegrations];

#if SENTRY_HAS_UIKIT
// force the AppStateManager to unsubscribe, see
// https://github.com/getsentry/sentry-cocoa/issues/2455
[[SentryDependencyContainer sharedInstance].appStateManager stop:YES];
#endif

// close the client
SentryClient *client = [hub getClient];
Expand Down
2 changes: 2 additions & 0 deletions Tests/SentryTests/SentrySDKTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ class SentrySDKTests: XCTestCase {
assertIntegrationsInstalled(integrations: [])
}

#if SENTRY_HAS_UIKIT
func testClose_StopsAppStateManager() {
SentrySDK.start { options in
options.dsn = SentrySDKTests.dsnAsString
Expand All @@ -513,6 +514,7 @@ class SentrySDKTests: XCTestCase {

XCTAssertEqual(appStateManager.startCount, 0)
}
#endif

func testFlush_CallsFlushCorrectlyOnTransport() {
SentrySDK.start { options in
Expand Down

0 comments on commit 51f6f0e

Please sign in to comment.