Fixed issues encountered in the unit tests target after the project transitioned to Swift 6 and strict concurrency.

This commit is contained in:
2026-02-11 19:15:56 +01:00
parent e9e091c4d5
commit 546985bd98
6 changed files with 24 additions and 18 deletions
@@ -2,6 +2,7 @@ import Testing
@testable import Todos
@MainActor
@Suite("ContentView view model tests")
struct ContentViewModelTests {
@@ -3,6 +3,7 @@ import Testing
@testable import Todos
@MainActor
@Suite("NewTaskView view model tests")
struct NewTaskViewModelTests {
@@ -3,6 +3,7 @@ import Testing
@testable import Todos
@MainActor
@Suite("TaskGroupListView view model tests")
struct TaskGroupListViewModelTests {
@@ -32,7 +33,7 @@ struct TaskGroupListViewModelTests {
@Test(
"count returns zero when empty data",
arguments: TodoGroup.allCases
arguments: [TodoGroup.today, .upcoming, .overdue, .completed]
)
func countWhenEmptyData(for group: TodoGroup) throws {
// GIVEN
@@ -47,7 +48,7 @@ struct TaskGroupListViewModelTests {
@Test(
"count returns correct count when filled data",
arguments: TodoGroup.allCases
arguments: [TodoGroup.today, .upcoming, .overdue, .completed]
)
func countWhenFilledData(for group: TodoGroup) throws {
// GIVEN
@@ -3,6 +3,7 @@ import Testing
@testable import Todos
@MainActor
@Suite("TaskList view model tests")
struct TaskListViewModelTests {
@@ -10,7 +11,7 @@ struct TaskListViewModelTests {
@Test(
"properties are set correctly during initialization",
arguments: TodoGroup.allCases
arguments: [TodoGroup.today, .upcoming, .overdue, .completed]
)
func initialization(for group: TodoGroup) {
// GIVEN
@@ -26,7 +27,7 @@ struct TaskListViewModelTests {
@Test(
"buttonCompleted returns correct values when showCompleted is true",
arguments: TodoGroup.allCases, [true, false]
arguments: [TodoGroup.today, .upcoming, .overdue, .completed], [true, false]
)
func buttonCompleted(
for group: TodoGroup,
@@ -54,7 +55,7 @@ struct TaskListViewModelTests {
@Test(
"canShowCompleted returns correct value for each group",
arguments: zip(
TodoGroup.allCases,
[TodoGroup.today, .upcoming, .overdue, .completed],
[true, true, true, false]
)
)
@@ -74,7 +75,7 @@ struct TaskListViewModelTests {
@Test(
"navigationTitle returns correct view title for each group",
arguments: TodoGroup.allCases
arguments: [TodoGroup.today, .upcoming, .overdue, .completed]
)
func navigationTitle(for group: TodoGroup) {
// GIVEN