|
1 |
| -import Testing |
2 | 1 |
|
| 2 | +import XCTest |
3 | 3 | @testable import BeeSwift
|
4 | 4 | @testable import BeeKit
|
5 | 5 |
|
6 |
| -struct GoalViewModelTests { |
| 6 | +final class GoalViewModelTests: XCTestCase { |
7 | 7 | private enum DayStep: Double {
|
8 | 8 | case previousDay = -1
|
9 | 9 | case sameDay = 0
|
10 | 10 | case nextDay = 1
|
11 | 11 | }
|
12 | 12 |
|
13 |
| - @Test func initialStepperIsYesterdayWhenSubmissionDateIsAfterMidnightAndBeforeDeadline() async throws { |
| 13 | + func testInitialStepperIsYesterdayWhenSubmissionDateIsAfterMidnightAndBeforeDeadline() async throws { |
14 | 14 | let goalWithAfterMidnightDeadline = Self.makeGoalWithDeadline(3600 * 3)
|
15 | 15 | let viewModel = GoalViewModel(goal: goalWithAfterMidnightDeadline)
|
16 | 16 | let submissionDateBeforeGoalsDeadline = Calendar.current.date(bySettingHour: 1, minute: 30, second: 0, of: Date())!
|
17 | 17 | let actual = viewModel.initialDateStepperValue(submissionDate: submissionDateBeforeGoalsDeadline)
|
18 |
| - #expect(actual == DayStep.previousDay.rawValue) |
| 18 | + XCTAssertEqual(actual, |
| 19 | + DayStep.previousDay.rawValue) |
19 | 20 | }
|
20 | 21 |
|
21 |
| - @Test func initialStepperIsTodayWhenSubmissionDateIsBeforeMidnightAndBeforeDeadline() async throws { |
| 22 | + func testInitialStepperIsTodayWhenSubmissionDateIsBeforeMidnightAndBeforeDeadline() async throws { |
22 | 23 | let goalWithMidnightDeadline = Self.makeGoalWithDeadline(0)
|
23 | 24 | let viewModel = GoalViewModel(goal: goalWithMidnightDeadline)
|
24 | 25 | let submissionDateBeforeMidnight = Calendar.current.date(bySettingHour: 20, minute: 30, second: 0, of: Date())!
|
25 | 26 | let actual = viewModel.initialDateStepperValue(submissionDate: submissionDateBeforeMidnight)
|
26 |
| - #expect(actual == DayStep.sameDay.rawValue) |
| 27 | + XCTAssertEqual(actual, |
| 28 | + DayStep.sameDay.rawValue) |
27 | 29 | }
|
28 |
| - |
29 |
| - @Test func initialStepperIsTomorrowWhenSubmissionDateIsAfterDeadline() async throws { |
| 30 | + |
| 31 | + func testInitialStepperIsTomorrowWhenSubmissionDateIsAfterDeadline() async throws { |
30 | 32 | let goalWithBeforeMidnightDeadline = Self.makeGoalWithDeadline(3600 * -3)
|
31 | 33 | let viewModel = GoalViewModel(goal: goalWithBeforeMidnightDeadline)
|
32 | 34 | let submissionDateBetweenDeadlineAndMidnight = Calendar.current.date(bySettingHour: 22, minute: 30, second: 0, of: Date())!
|
33 | 35 | let actual = viewModel.initialDateStepperValue(submissionDate: submissionDateBetweenDeadlineAndMidnight)
|
34 |
| - #expect(actual == DayStep.nextDay.rawValue) |
| 36 | + XCTAssertEqual(actual, |
| 37 | + DayStep.nextDay.rawValue) |
35 | 38 | }
|
36 | 39 | }
|
37 | 40 |
|
|
0 commit comments