Skip to content

Commit

Permalink
Revert "Unit Tests: removed leak detection (#2792)"
Browse files Browse the repository at this point in the history
This reverts commit 0a814ed.

The actual fix for the problem was #2802.
  • Loading branch information
NachoSoto committed Jul 13, 2023
1 parent f7e36fb commit 7bc5165
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Tests/UnitTests/Purchasing/Purchases/BasePurchasesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,25 @@ class BasePurchasesTests: TestCase {
// Because unit tests can run in parallel, if a test needs to modify
// this level it should be moved to `StoreKitUnitTests`, which runs serially.
Purchases.logLevel = .verbose

self.addTeardownBlock {
weak var purchases = self.purchases
weak var orchestrator = self.purchasesOrchestrator
weak var deviceCache = self.deviceCache

Purchases.clearSingleton()
self.clearReferences()

expect(purchases)
.toEventually(beNil(), description: "Purchases has leaked")
expect(orchestrator)
.toEventually(beNil(), description: "PurchasesOrchestrator has leaked")
expect(deviceCache)
.toEventually(beNil(), description: "DeviceCache has leaked: \(self)")
}
}

override func tearDown() {
Purchases.clearSingleton()
self.clearReferences()

self.userDefaults.removePersistentDomain(forName: Self.userDefaultsSuiteName)

super.tearDown()
Expand Down

0 comments on commit 7bc5165

Please sign in to comment.