Improved some tests cases for the NewTaskViewModelTests and the TaskGroupListViewModelTests tests in the unit tests target.
This commit is contained in:
@@ -124,10 +124,7 @@ struct NewTaskViewModelTests {
|
||||
@MainActor
|
||||
func saveWithAllProperties() throws {
|
||||
// GIVEN
|
||||
let container = try ModelContainer(
|
||||
for: Todo.self,
|
||||
configurations: .init(isStoredInMemoryOnly: true)
|
||||
)
|
||||
let container = try modelContainer
|
||||
let context = container.mainContext
|
||||
let viewModel = NewTaskView.ViewModel()
|
||||
|
||||
@@ -153,10 +150,7 @@ struct NewTaskViewModelTests {
|
||||
@MainActor
|
||||
func saveWithEmptyNote() throws {
|
||||
// GIVEN
|
||||
let container = try ModelContainer(
|
||||
for: Todo.self,
|
||||
configurations: .init(isStoredInMemoryOnly: true)
|
||||
)
|
||||
let container = try modelContainer
|
||||
let context = container.mainContext
|
||||
let viewModel = NewTaskView.ViewModel()
|
||||
|
||||
@@ -182,10 +176,7 @@ struct NewTaskViewModelTests {
|
||||
@MainActor
|
||||
func saveWithWhitespaceNote() throws {
|
||||
// GIVEN
|
||||
let container = try ModelContainer(
|
||||
for: Todo.self,
|
||||
configurations: .init(isStoredInMemoryOnly: true)
|
||||
)
|
||||
let container = try modelContainer
|
||||
let context = container.mainContext
|
||||
let viewModel = NewTaskView.ViewModel()
|
||||
|
||||
@@ -211,10 +202,7 @@ struct NewTaskViewModelTests {
|
||||
@MainActor
|
||||
func saveMultipleTodos() throws {
|
||||
// GIVEN
|
||||
let container = try ModelContainer(
|
||||
for: Todo.self,
|
||||
configurations: .init(isStoredInMemoryOnly: true)
|
||||
)
|
||||
let container = try modelContainer
|
||||
let context = container.mainContext
|
||||
let viewModelFirst = NewTaskView.ViewModel()
|
||||
let viewModelSecond = NewTaskView.ViewModel()
|
||||
@@ -237,3 +225,20 @@ struct NewTaskViewModelTests {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
private extension NewTaskViewModelTests {
|
||||
|
||||
// MARK: Computed
|
||||
|
||||
var modelContainer: ModelContainer {
|
||||
get throws {
|
||||
try ModelContainer(
|
||||
for: Todo.self,
|
||||
configurations: .init(isStoredInMemoryOnly: true)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user