Todo repository protocol #8
@@ -3,6 +3,7 @@ import Testing
|
|||||||
|
|
||||||
@testable import Todos
|
@testable import Todos
|
||||||
|
|
||||||
|
@MainActor
|
||||||
@Suite("TodoGroup enumeration tests")
|
@Suite("TodoGroup enumeration tests")
|
||||||
struct TodoGroupTests {
|
struct TodoGroupTests {
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ struct TodoGroupTests {
|
|||||||
@Test(
|
@Test(
|
||||||
"canShowCompleted returns correct values",
|
"canShowCompleted returns correct values",
|
||||||
arguments: zip(
|
arguments: zip(
|
||||||
TodoGroup.allCases,
|
[TodoGroup.today, .upcoming, .overdue, .completed],
|
||||||
[true, true, true, false]
|
[true, true, true, false]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -30,7 +31,7 @@ struct TodoGroupTests {
|
|||||||
@Test(
|
@Test(
|
||||||
"canReorder returns correct values",
|
"canReorder returns correct values",
|
||||||
arguments: zip(
|
arguments: zip(
|
||||||
TodoGroup.allCases,
|
[TodoGroup.today, .upcoming, .overdue, .completed],
|
||||||
[true, true, true, false]
|
[true, true, true, false]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -49,7 +50,7 @@ struct TodoGroupTests {
|
|||||||
@Test(
|
@Test(
|
||||||
"group color match expected values",
|
"group color match expected values",
|
||||||
arguments: zip(
|
arguments: zip(
|
||||||
TodoGroup.allCases,
|
[TodoGroup.today, .upcoming, .overdue, .completed],
|
||||||
[Color.blue, .green, .red, .gray]
|
[Color.blue, .green, .red, .gray]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -68,7 +69,7 @@ struct TodoGroupTests {
|
|||||||
@Test(
|
@Test(
|
||||||
"group icon names match expected values",
|
"group icon names match expected values",
|
||||||
arguments: zip(
|
arguments: zip(
|
||||||
TodoGroup.allCases,
|
[TodoGroup.today, .upcoming, .overdue, .completed],
|
||||||
["calendar.badge.clock", "calendar", "calendar.badge.exclamationmark", "checkmark.circle.fill"]
|
["calendar.badge.clock", "calendar", "calendar.badge.exclamationmark", "checkmark.circle.fill"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -87,7 +88,7 @@ struct TodoGroupTests {
|
|||||||
@Test(
|
@Test(
|
||||||
"group titles match expected values",
|
"group titles match expected values",
|
||||||
arguments: zip(
|
arguments: zip(
|
||||||
TodoGroup.allCases,
|
[TodoGroup.today, .upcoming, .overdue, .completed],
|
||||||
["today", "upcoming", "overdue", "completed"]
|
["today", "upcoming", "overdue", "completed"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -123,7 +124,10 @@ struct TodoGroupTests {
|
|||||||
|
|
||||||
// MARK: Identifiable Tests
|
// 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) {
|
func id(for group: TodoGroup) {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
// WHEN
|
// WHEN
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import Testing
|
|||||||
|
|
||||||
@testable import Todos
|
@testable import Todos
|
||||||
|
|
||||||
|
@MainActor
|
||||||
@Suite("TodoFetchDescriptor+Inits extension tests")
|
@Suite("TodoFetchDescriptor+Inits extension tests")
|
||||||
struct TodoFetchDescriptor_InitsTests {
|
struct TodoFetchDescriptor_InitsTests {
|
||||||
|
|
||||||
@@ -11,9 +12,8 @@ struct TodoFetchDescriptor_InitsTests {
|
|||||||
|
|
||||||
@Test(
|
@Test(
|
||||||
"initialization when empty tasks",
|
"initialization when empty tasks",
|
||||||
arguments: TodoGroup.allCases
|
arguments: [TodoGroup.today, .upcoming, .overdue, .completed]
|
||||||
)
|
)
|
||||||
@MainActor
|
|
||||||
func initializationWhenEmptyTasks(for group: TodoGroup) throws {
|
func initializationWhenEmptyTasks(for group: TodoGroup) throws {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
let container = try modelContainer
|
let container = try modelContainer
|
||||||
@@ -32,9 +32,8 @@ struct TodoFetchDescriptor_InitsTests {
|
|||||||
|
|
||||||
@Test(
|
@Test(
|
||||||
"initialization with show completed disabled",
|
"initialization with show completed disabled",
|
||||||
arguments: TodoGroup.allCases
|
arguments: [TodoGroup.today, .upcoming, .overdue, .completed]
|
||||||
)
|
)
|
||||||
@MainActor
|
|
||||||
func initializationWithNoShowCompleted(for group: TodoGroup) throws {
|
func initializationWithNoShowCompleted(for group: TodoGroup) throws {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
let container = try modelContainer
|
let container = try modelContainer
|
||||||
@@ -70,9 +69,8 @@ struct TodoFetchDescriptor_InitsTests {
|
|||||||
|
|
||||||
@Test(
|
@Test(
|
||||||
"initialization with show completed enabled",
|
"initialization with show completed enabled",
|
||||||
arguments: TodoGroup.allCases
|
arguments: [TodoGroup.today, .upcoming, .overdue, .completed]
|
||||||
)
|
)
|
||||||
@MainActor
|
|
||||||
func initializationWithShowCompleted(for group: TodoGroup) throws {
|
func initializationWithShowCompleted(for group: TodoGroup) throws {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
let container = try modelContainer
|
let container = try modelContainer
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import Testing
|
|||||||
|
|
||||||
@testable import Todos
|
@testable import Todos
|
||||||
|
|
||||||
|
@MainActor
|
||||||
@Suite("ContentView view model tests")
|
@Suite("ContentView view model tests")
|
||||||
struct ContentViewModelTests {
|
struct ContentViewModelTests {
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import Testing
|
|||||||
|
|
||||||
@testable import Todos
|
@testable import Todos
|
||||||
|
|
||||||
|
@MainActor
|
||||||
@Suite("NewTaskView view model tests")
|
@Suite("NewTaskView view model tests")
|
||||||
struct NewTaskViewModelTests {
|
struct NewTaskViewModelTests {
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import Testing
|
|||||||
|
|
||||||
@testable import Todos
|
@testable import Todos
|
||||||
|
|
||||||
|
@MainActor
|
||||||
@Suite("TaskGroupListView view model tests")
|
@Suite("TaskGroupListView view model tests")
|
||||||
struct TaskGroupListViewModelTests {
|
struct TaskGroupListViewModelTests {
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ struct TaskGroupListViewModelTests {
|
|||||||
|
|
||||||
@Test(
|
@Test(
|
||||||
"count returns zero when empty data",
|
"count returns zero when empty data",
|
||||||
arguments: TodoGroup.allCases
|
arguments: [TodoGroup.today, .upcoming, .overdue, .completed]
|
||||||
)
|
)
|
||||||
func countWhenEmptyData(for group: TodoGroup) throws {
|
func countWhenEmptyData(for group: TodoGroup) throws {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
@@ -47,7 +48,7 @@ struct TaskGroupListViewModelTests {
|
|||||||
|
|
||||||
@Test(
|
@Test(
|
||||||
"count returns correct count when filled data",
|
"count returns correct count when filled data",
|
||||||
arguments: TodoGroup.allCases
|
arguments: [TodoGroup.today, .upcoming, .overdue, .completed]
|
||||||
)
|
)
|
||||||
func countWhenFilledData(for group: TodoGroup) throws {
|
func countWhenFilledData(for group: TodoGroup) throws {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import Testing
|
|||||||
|
|
||||||
@testable import Todos
|
@testable import Todos
|
||||||
|
|
||||||
|
@MainActor
|
||||||
@Suite("TaskList view model tests")
|
@Suite("TaskList view model tests")
|
||||||
struct TaskListViewModelTests {
|
struct TaskListViewModelTests {
|
||||||
|
|
||||||
@@ -10,7 +11,7 @@ struct TaskListViewModelTests {
|
|||||||
|
|
||||||
@Test(
|
@Test(
|
||||||
"properties are set correctly during initialization",
|
"properties are set correctly during initialization",
|
||||||
arguments: TodoGroup.allCases
|
arguments: [TodoGroup.today, .upcoming, .overdue, .completed]
|
||||||
)
|
)
|
||||||
func initialization(for group: TodoGroup) {
|
func initialization(for group: TodoGroup) {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
@@ -26,7 +27,7 @@ struct TaskListViewModelTests {
|
|||||||
|
|
||||||
@Test(
|
@Test(
|
||||||
"buttonCompleted returns correct values when showCompleted is true",
|
"buttonCompleted returns correct values when showCompleted is true",
|
||||||
arguments: TodoGroup.allCases, [true, false]
|
arguments: [TodoGroup.today, .upcoming, .overdue, .completed], [true, false]
|
||||||
)
|
)
|
||||||
func buttonCompleted(
|
func buttonCompleted(
|
||||||
for group: TodoGroup,
|
for group: TodoGroup,
|
||||||
@@ -54,7 +55,7 @@ struct TaskListViewModelTests {
|
|||||||
@Test(
|
@Test(
|
||||||
"canShowCompleted returns correct value for each group",
|
"canShowCompleted returns correct value for each group",
|
||||||
arguments: zip(
|
arguments: zip(
|
||||||
TodoGroup.allCases,
|
[TodoGroup.today, .upcoming, .overdue, .completed],
|
||||||
[true, true, true, false]
|
[true, true, true, false]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -74,7 +75,7 @@ struct TaskListViewModelTests {
|
|||||||
|
|
||||||
@Test(
|
@Test(
|
||||||
"navigationTitle returns correct view title for each group",
|
"navigationTitle returns correct view title for each group",
|
||||||
arguments: TodoGroup.allCases
|
arguments: [TodoGroup.today, .upcoming, .overdue, .completed]
|
||||||
)
|
)
|
||||||
func navigationTitle(for group: TodoGroup) {
|
func navigationTitle(for group: TodoGroup) {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
|
|||||||
Reference in New Issue
Block a user