Todo repository protocol (#8)

This PR contains the work done to decouple the direct use of the `ModelContext` from `SwiftData` from the view model that uses it. In addition, the project transitioned to use Swift 6 and strict concurrency which brought some issues with the unit tests, so they were amended as well.

Reviewed-on: rock-n-code/todos-app#8
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #8.
This commit is contained in:
2026-02-11 18:22:26 +00:00
committed by javier
parent b8e6e515dc
commit bbd7ec264b
13 changed files with 187 additions and 115 deletions
@@ -1,9 +1,9 @@
import Foundation
import SwiftData
import Testing
@testable import Todos
@MainActor
@Suite("TaskGroupListView view model tests")
struct TaskGroupListViewModelTests {
@@ -33,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
@@ -48,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