mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-09 22:35:56 +05:45
70 lines
2.2 KiB
Swift
70 lines
2.2 KiB
Swift
//
|
|
// Copyright RevenueCat Inc. All Rights Reserved.
|
|
//
|
|
// Licensed under the MIT License (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://opensource.org/licenses/MIT
|
|
//
|
|
// FallbackURLBackendIntegrationTests.swift
|
|
//
|
|
// Created by Antonio Pallares on 23/10/25.
|
|
|
|
// swiftlint:disable type_name
|
|
|
|
import Nimble
|
|
@testable import RevenueCat
|
|
import SnapshotTesting
|
|
import StoreKit
|
|
import XCTest
|
|
|
|
class FallbackURLUnsignedBackendStoreKit2IntegrationTests: FallbackURLSignedBackendStoreKit2IntegrationTests {
|
|
|
|
override class var responseVerificationMode: Signing.ResponseVerificationMode {
|
|
return .disabled
|
|
}
|
|
}
|
|
|
|
class FallbackURLUnsignedBackendStoreKit1IntegrationTests: FallbackURLSignedBackendStoreKit1IntegrationTests {
|
|
|
|
override class var responseVerificationMode: Signing.ResponseVerificationMode {
|
|
return .disabled
|
|
}
|
|
}
|
|
|
|
class FallbackURLSignedBackendStoreKit1IntegrationTests: FallbackURLSignedBackendStoreKit2IntegrationTests {
|
|
|
|
override class var storeKitVersion: StoreKitVersion { .storeKit1 }
|
|
}
|
|
|
|
class FallbackURLSignedBackendStoreKit2IntegrationTests: BaseStoreKitIntegrationTests {
|
|
|
|
override class var storeKitVersion: StoreKitVersion { .storeKit2 }
|
|
|
|
override class var responseVerificationMode: Signing.ResponseVerificationMode {
|
|
return Signing.enforcedVerificationMode()
|
|
}
|
|
|
|
override func setUp() async throws {
|
|
self.mainServerDown()
|
|
try await super.setUp()
|
|
}
|
|
|
|
func testCanGetOfferingsFromFallbackURL() async throws {
|
|
let receivedOfferings = try await self.purchases.offerings()
|
|
|
|
expect(receivedOfferings.all).toNot(beEmpty())
|
|
assertSnapshot(of: receivedOfferings.response, as: .formattedJson)
|
|
expect(receivedOfferings.contents.originalSource) == .fallbackUrl
|
|
}
|
|
|
|
func testCanGetProductEntitlementMappingFromFallbackURL() async throws {
|
|
let productEntitlementMapping = try await self.purchases.productEntitlementMapping()
|
|
|
|
expect(productEntitlementMapping.entitlementsByProduct).toNot(beEmpty())
|
|
assertSnapshot(of: productEntitlementMapping, as: .formattedJson)
|
|
}
|
|
|
|
}
|