New task feature (#2)
This PR contains the work done to implement the **New Task** feature, and to integrate it into the main context view of the app. Reviewed-on: rock-n-code/todos-app#2 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 #2.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import Foundation
|
||||
import SwiftData
|
||||
import Testing
|
||||
|
||||
@testable import Todos
|
||||
|
||||
@Suite("ContentView.ViewModel 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)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user