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:
@@ -1,9 +1,9 @@
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
import Testing
|
||||
|
||||
@testable import Todos
|
||||
|
||||
@MainActor
|
||||
@Suite("TodoGroup enumeration tests")
|
||||
struct TodoGroupTests {
|
||||
|
||||
@@ -12,7 +12,7 @@ struct TodoGroupTests {
|
||||
@Test(
|
||||
"canShowCompleted returns correct values",
|
||||
arguments: zip(
|
||||
TodoGroup.allCases,
|
||||
[TodoGroup.today, .upcoming, .overdue, .completed],
|
||||
[true, true, true, false]
|
||||
)
|
||||
)
|
||||
@@ -31,7 +31,7 @@ struct TodoGroupTests {
|
||||
@Test(
|
||||
"canReorder returns correct values",
|
||||
arguments: zip(
|
||||
TodoGroup.allCases,
|
||||
[TodoGroup.today, .upcoming, .overdue, .completed],
|
||||
[true, true, true, false]
|
||||
)
|
||||
)
|
||||
@@ -50,7 +50,7 @@ struct TodoGroupTests {
|
||||
@Test(
|
||||
"group color match expected values",
|
||||
arguments: zip(
|
||||
TodoGroup.allCases,
|
||||
[TodoGroup.today, .upcoming, .overdue, .completed],
|
||||
[Color.blue, .green, .red, .gray]
|
||||
)
|
||||
)
|
||||
@@ -69,7 +69,7 @@ struct TodoGroupTests {
|
||||
@Test(
|
||||
"group icon names match expected values",
|
||||
arguments: zip(
|
||||
TodoGroup.allCases,
|
||||
[TodoGroup.today, .upcoming, .overdue, .completed],
|
||||
["calendar.badge.clock", "calendar", "calendar.badge.exclamationmark", "checkmark.circle.fill"]
|
||||
)
|
||||
)
|
||||
@@ -88,7 +88,7 @@ struct TodoGroupTests {
|
||||
@Test(
|
||||
"group titles match expected values",
|
||||
arguments: zip(
|
||||
TodoGroup.allCases,
|
||||
[TodoGroup.today, .upcoming, .overdue, .completed],
|
||||
["today", "upcoming", "overdue", "completed"]
|
||||
)
|
||||
)
|
||||
@@ -124,7 +124,10 @@ struct TodoGroupTests {
|
||||
|
||||
// MARK: Identifiable Tests
|
||||
|
||||
@Test("id returns an identity of a case", arguments: TodoGroup.allCases)
|
||||
@Test(
|
||||
"id returns an identity of a case",
|
||||
arguments: [TodoGroup.today, .upcoming, .overdue, .completed]
|
||||
)
|
||||
func id(for group: TodoGroup) {
|
||||
// GIVEN
|
||||
// WHEN
|
||||
|
||||
Reference in New Issue
Block a user