diff --git a/Tests/BackendIntegrationTests/SignatureVerificationIntegrationTests.swift b/Tests/BackendIntegrationTests/SignatureVerificationIntegrationTests.swift index 0d12253447..90e21ec280 100644 --- a/Tests/BackendIntegrationTests/SignatureVerificationIntegrationTests.swift +++ b/Tests/BackendIntegrationTests/SignatureVerificationIntegrationTests.swift @@ -219,7 +219,18 @@ 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() @@ -227,6 +238,15 @@ class DynamicModeSignatureVerificationIntegrationTests: BaseSignatureVerificatio 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 { @@ -239,11 +259,6 @@ class DynamicModeSignatureVerificationIntegrationTests: BaseSignatureVerificatio } } - private func changeMode(to newMode: Signing.ResponseVerificationMode) async { - Self.currentMode = newMode - await self.resetSingleton() - } - } // MARK: - Private