Skip to content

Commit

Permalink
Another test
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoSoto committed Jun 28, 2023
1 parent 7704b12 commit ea465be
Showing 1 changed file with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,34 @@ class DynamicModeSignatureVerificationIntegrationTests: BaseSignatureVerificatio
_ = try await Purchases.shared.customerInfo(fetchPolicy: .fromCacheOnly)
}

func testEnablingSignatureVerificationResetsCustomerInfoCache() async throws {
func testChangingToInformationalModeResetsCustomerInfoCache() async throws {
// 1. Fetch CustomerInfo
_ = try await Purchases.shared.customerInfo()

// 2. Enable signature verification
await self.changeMode(to: Signing.verificationMode(with: .informational))

// 3. Verify CustomerInfo is not cached anymore
await self.verifyNoCachedCustomerInfo()
}

func testChangingToEnforcedModeResetsCustomerInfoCache() async throws {
// 1. Fetch CustomerInfo
_ = try await Purchases.shared.customerInfo()

// 2. Enable signature verification
await self.changeMode(to: Signing.enforcedVerificationMode())

// 3. Verify CustomerInfo is not cached anymore
await self.verifyNoCachedCustomerInfo()
}

private func changeMode(to newMode: Signing.ResponseVerificationMode) async {
Self.currentMode = newMode
await self.resetSingleton()
}

private func verifyNoCachedCustomerInfo() async {
do {
_ = try await Purchases.shared.customerInfo(fetchPolicy: .fromCacheOnly)
} catch {
Expand All @@ -239,11 +259,6 @@ class DynamicModeSignatureVerificationIntegrationTests: BaseSignatureVerificatio
}
}

private func changeMode(to newMode: Signing.ResponseVerificationMode) async {
Self.currentMode = newMode
await self.resetSingleton()
}

}

// MARK: - Private
Expand Down

0 comments on commit ea465be

Please sign in to comment.