hopefully fix issue where voting is filled in with missing when its time to vote

This commit is contained in:
Trey t
2022-03-05 11:28:29 -06:00
parent 012fcc43d5
commit d56e74053e
13 changed files with 168 additions and 105 deletions

View File

@@ -6,9 +6,9 @@
//
import XCTest
@testable import iFeel
class Tests_iOS: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
@@ -22,21 +22,36 @@ class Tests_iOS: XCTestCase {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
func testDatesBetween() {
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 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())
XCTAssertTrue(dates.last == yesterday)
XCTAssertTrue(dates.first == tenDaysAgo)
}
func testDatesIncluding() {
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)!
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
let dates = Date.dates(from: Calendar.current.date(byAdding: .day, value: -10, to: Date())!, toDate: Date(), includingToDate: true)
XCTAssertTrue(dates.last == today)
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)
// }
}

View File

@@ -17,7 +17,7 @@ class Tests_iOSLaunchTests: XCTestCase {
continueAfterFailure = false
}
func testLaunch() throws {
func _testLaunch() throws {
let app = XCUIApplication()
app.launch()