This PR contains the work done to implement the **Group Task** feature, and to integrate it into the main content view of the app. Furthermore, an issue related to triggering a view update after inserting the todo tasks into the model container has been fixed. Reviewed-on: rock-n-code/todos-app#3 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
37 lines
719 B
Swift
37 lines
719 B
Swift
import Foundation
|
|
import SwiftData
|
|
import Testing
|
|
|
|
@testable import Todos
|
|
|
|
@Suite("ContentView view model tests")
|
|
struct ContentViewModelTests {
|
|
|
|
// MARK: Initialization Tests
|
|
|
|
@Test("View model initializes with default values")
|
|
func initialization() {
|
|
// GIVEN
|
|
// WHEN
|
|
let viewModel = ContentView.ViewModel()
|
|
|
|
// THEN
|
|
#expect(viewModel.newTaskShown == false)
|
|
}
|
|
|
|
// MARK: - Functions Tests
|
|
|
|
@Test("showNewTask sets showNewTaskView to true")
|
|
func newTaskShown() {
|
|
// GIVEN
|
|
let viewModel = ContentView.ViewModel()
|
|
|
|
// WHEN
|
|
viewModel.showNewTask()
|
|
|
|
// THEN
|
|
#expect(viewModel.newTaskShown == true)
|
|
}
|
|
|
|
}
|