     func testPurchaseMadeBeforeLogInWithExistingUserIsNotRetainedUnlessRestoreCalled() {
         var completionCalled = false
         let existingUserID = "\(#function)\(UUID().uuidString)"
-        expect(self.purchasesDelegate.customerInfoUpdateCount).toEventually(equal(1), timeout: .seconds(10))
+        self.waitUntilCustomerInfoIsUpdated()
 
         // log in to create the user, then log out
         Purchases.shared.logIn(existingUserID) { logInCustomerInfo, created, logInError in

    func testPurchaseAsIdentifiedThenLogOutThenRestoreGrantsEntitlements() {
        var completionCalled = false
        let existingUserID = UUID().uuidString
        expect(self.purchasesDelegate.customerInfoUpdateCount).toEventually(equal(1), timeout: .seconds(10))

        Purchases.shared.logIn(existingUserID) { logInCustomerInfo, created, logInError in
            self.purchaseMonthlyOffering()

    func assertNoPurchases(_ customerInfo: CustomerInfo?) {
        expect(customerInfo?.entitlements.all.count) == 0
    }

    func waitUntilCustomerInfoIsUpdated() {
        expect(self.purchasesDelegate.customerInfoUpdateCount).toEventually(equal(1), timeout: .seconds(10))
    }
    
}
