Retrofit deferFulfillment onto snapshot tests. (#3641)

* Retrofit `deferFulfillment` onto snapshot tests.

* Convert a bunch of preview tests to the new fulfillment publisher

* Convert more tests

* Remove unneeded delays from the remaining tests

* Remove snapshotting delay option.
This commit is contained in:
Stefan Ceriu
2024-12-20 15:30:59 +02:00
committed by GitHub
parent 365797c8b7
commit 536f01abbd
49 changed files with 606 additions and 532 deletions
@@ -127,23 +127,32 @@ struct KnockRequestsListScreen_Previews: PreviewProvider, TestablePreview {
NavigationStack {
KnockRequestsListScreen(context: viewModel.context)
}
.snapshotPreferences(delay: 0.2)
.snapshotPreferences(expect: viewModel.context.$viewState.map { state in
state.shouldDisplayRequests == true
})
NavigationStack {
KnockRequestsListScreen(context: singleRequestViewModel.context)
}
.snapshotPreferences(expect: singleRequestViewModel.context.$viewState.map { state in
state.shouldDisplayRequests == true
})
.previewDisplayName("Single Request")
.snapshotPreferences(delay: 0.2)
NavigationStack {
KnockRequestsListScreen(context: emptyViewModel.context)
}
.snapshotPreferences(expect: emptyViewModel.context.$viewState.map { state in
state.shouldDisplayEmptyView == true
})
.previewDisplayName("Empty state")
.snapshotPreferences(delay: 0.2)
NavigationStack {
KnockRequestsListScreen(context: loadingViewModel.context)
}
.snapshotPreferences(expect: loadingViewModel.context.$viewState.map { state in
state.isLoading == true
})
.previewDisplayName("Loading state")
}
}