mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-11 22:55:55 +05:45
* feat: add `hasPaywall` getter to `Offering` Returns `true` if the offering has either a v1 or a v2 paywall * docs: update some methods references changing `PaywallData` with "paywall", as `PaywallData` only refers to v1 paywalls * docs: improve reference of `Offering`'s `paywall` and `paywallComponents` to mention the new `hasPaywall` property * lint * tests: add unit tests that check the `hasPaywall` property of `Offering` * api tests: add `paywallComponents` and `hasPaywall` to SwiftAPITester
54 lines
1.5 KiB
Swift
54 lines
1.5 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
|
|
//
|
|
// BaseHTTPResponseTest.swift
|
|
//
|
|
// Created by Nacho Soto on 4/12/22.
|
|
|
|
@testable import RevenueCat
|
|
import XCTest
|
|
|
|
class BaseHTTPResponseTest: TestCase {
|
|
|
|
static func decodeFixture<T: HTTPResponseBody>(
|
|
_ name: String,
|
|
file: StaticString = #filePath,
|
|
line: UInt = #line
|
|
) throws -> T {
|
|
return try T.create(with: self.data(for: name, file: file, line: line))
|
|
}
|
|
|
|
@_disfavoredOverload
|
|
static func decodeFixture<T: Decodable>(
|
|
_ name: String,
|
|
file: StaticString = #filePath,
|
|
line: UInt = #line
|
|
) throws -> T {
|
|
return try T.create(with: self.data(for: name, file: file, line: line))
|
|
}
|
|
|
|
private static func data(
|
|
for fileName: String,
|
|
file: StaticString,
|
|
line: UInt
|
|
) throws -> Data {
|
|
let url = try XCTUnwrap(
|
|
Bundle(for: BundleToken.self).url(forResource: fileName,
|
|
withExtension: "json",
|
|
subdirectory: "Fixtures"),
|
|
"Could not find file with name: '\(fileName).json'",
|
|
file: file, line: line
|
|
)
|
|
return try XCTUnwrap(Data(contentsOf: url), file: file, line: line)
|
|
}
|
|
|
|
}
|
|
|
|
private final class BundleToken: NSObject {}
|