Skip to content

Commit

Permalink
Integration Tests: fixed Purchases leak through `PurchasesDiagnos…
Browse files Browse the repository at this point in the history
…tics` (#2126)

Calling `PurchasesDiagnostics.default` was lazily initializing it:
```swift
public static let `default`: PurchasesDiagnostics = .init(purchases: Purchases.shared)
```

Which was keeping a reference to `Purchases.shared` around.
For most cases this is fine, since `Purchases` would only be initialized
once, but for tests it meant that it was leaking, which is now detected
by #2106.
  • Loading branch information
NachoSoto authored Dec 9, 2022
1 parent dc41f03 commit 78fabc4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Tests/BackendIntegrationTests/StoreKitIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class StoreKit1IntegrationTests: BaseBackendIntegrationTests {
}

func testPurchasesDiagnostics() async throws {
let diagnostics = PurchasesDiagnostics.default
let diagnostics = PurchasesDiagnostics(purchases: Purchases.shared)

try await diagnostics.testSDKHealth()
}

Expand Down

0 comments on commit 78fabc4

Please sign in to comment.