Fix Tests iOS build: update deployment target and remove @testable import
Tests iOS target had deployment target 15.2 (mismatched with app's 26.0) causing linker failures. Also replaced @testable import Feels with a local Date extension copy since UI test targets can't link the app module. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1128,7 +1128,7 @@
|
|||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.2;
|
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.88oak.Tests-iOS";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.88oak.Tests-iOS";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
@@ -1146,7 +1146,7 @@
|
|||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.2;
|
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.88oak.Tests-iOS";
|
PRODUCT_BUNDLE_IDENTIFIER = "com.88oak.Tests-iOS";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
|||||||
@@ -6,36 +6,53 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import XCTest
|
import XCTest
|
||||||
@testable import Feels
|
|
||||||
|
// Local copy — UI test target cannot @testable import Feels
|
||||||
|
private extension Date {
|
||||||
|
static func dates(from fromDate: Date, toDate: Date, includingToDate: Bool = false) -> [Date] {
|
||||||
|
var dates: [Date] = []
|
||||||
|
var date = Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: fromDate)!
|
||||||
|
let toDate = Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: toDate)!
|
||||||
|
|
||||||
|
if includingToDate {
|
||||||
|
while date <= toDate {
|
||||||
|
dates.append(date)
|
||||||
|
guard let newDate = Calendar.current.date(byAdding: .day, value: 1, to: date) else { break }
|
||||||
|
date = newDate
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while date < toDate {
|
||||||
|
dates.append(date)
|
||||||
|
guard let newDate = Calendar.current.date(byAdding: .day, value: 1, to: date) else { break }
|
||||||
|
date = newDate
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dates
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class Tests_iOS: XCTestCase {
|
class Tests_iOS: XCTestCase {
|
||||||
override func setUpWithError() throws {
|
override func setUpWithError() throws {
|
||||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
|
||||||
|
|
||||||
// In UI tests it is usually best to stop immediately when a failure occurs.
|
|
||||||
continueAfterFailure = false
|
continueAfterFailure = false
|
||||||
|
|
||||||
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tearDownWithError() throws {
|
override func tearDownWithError() throws {
|
||||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testDatesBetween() {
|
func testDatesBetween() {
|
||||||
let today = Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: Date())!
|
let today = Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: Date())!
|
||||||
let yesterday = Calendar.current.date(byAdding: .day, value: -1, to: today)!
|
let yesterday = Calendar.current.date(byAdding: .day, value: -1, to: today)!
|
||||||
let tenDaysAgo = Calendar.current.date(byAdding: .day, value: -10, to: today)!
|
let tenDaysAgo = Calendar.current.date(byAdding: .day, value: -10, to: today)!
|
||||||
|
|
||||||
let dates = Date.dates(from: Calendar.current.date(byAdding: .day, value: -10, to: Date())!, toDate: Date())
|
let dates = Date.dates(from: Calendar.current.date(byAdding: .day, value: -10, to: Date())!, toDate: Date())
|
||||||
|
|
||||||
XCTAssertTrue(dates.last == yesterday)
|
XCTAssertTrue(dates.last == yesterday)
|
||||||
XCTAssertTrue(dates.first == tenDaysAgo)
|
XCTAssertTrue(dates.first == tenDaysAgo)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testDatesIncluding() {
|
func testDatesIncluding() {
|
||||||
let today = Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: Date())!
|
let today = Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: Date())!
|
||||||
let yesterday = Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: Date())!
|
|
||||||
let tenDaysAgo = Calendar.current.date(byAdding: .day, value: -10, to: today)!
|
let tenDaysAgo = Calendar.current.date(byAdding: .day, value: -10, to: today)!
|
||||||
|
|
||||||
let dates = Date.dates(from: Calendar.current.date(byAdding: .day, value: -10, to: Date())!, toDate: Date(), includingToDate: true)
|
let dates = Date.dates(from: Calendar.current.date(byAdding: .day, value: -10, to: Date())!, toDate: Date(), includingToDate: true)
|
||||||
@@ -43,16 +60,4 @@ class Tests_iOS: XCTestCase {
|
|||||||
XCTAssertTrue(dates.last == today)
|
XCTAssertTrue(dates.last == today)
|
||||||
XCTAssertTrue(dates.first == tenDaysAgo)
|
XCTAssertTrue(dates.first == tenDaysAgo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// func testLastVoteShouldExist() {
|
|
||||||
// let todayOneHourAhead = Calendar.current.date(byAdding: .day, value: 1, to: Date())!
|
|
||||||
// let fakeOnboarding = OnboardingData()
|
|
||||||
// fakeOnboarding.inputDay = DayOptions.Today
|
|
||||||
// fakeOnboarding.date = todayOneHourAhead
|
|
||||||
//
|
|
||||||
// let lastDay = ShowBasedOnVoteLogics.getLastDateVoteShouldExist(onboardingData: fakeOnboarding)
|
|
||||||
// let yesterday = Calendar.current.date(byAdding: .day, value: -1, to: Date())!
|
|
||||||
// XCTAssertTrue(lastDay == yesterday)
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user