test(issues): add preview for notFound state and extend PaginationState debug init

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
systemblue 2026-06-11 14:07:52 -04:00
parent f39e9f682d
commit c82dedf957
2 changed files with 17 additions and 3 deletions

View file

@ -27,10 +27,11 @@ final class PaginationState<Item> {
self.pageSize = pageSize
}
init(items: [Item], hasMore: Bool = false, pageSize: Int = 20) {
init(items: [Item], hasMore: Bool = false, pageSize: Int = 20, notFound: Bool = false) {
self.items = items
self.hasMore = hasMore
self.pageSize = pageSize
self.notFound = notFound
}
@discardableResult

View file

@ -151,11 +151,12 @@ struct IssueListView: View {
}
#if DEBUG
init(preview _: Void, repository: Repository, authService: AuthenticationService, issues: [Issue]) {
init(preview _: Void, repository: Repository, authService: AuthenticationService, issues: [Issue],
notFound: Bool = false) {
self.repository = repository
self.authService = authService
issueService = nil
_pagination = State(initialValue: PaginationState(items: issues))
_pagination = State(initialValue: PaginationState(items: issues, notFound: notFound))
}
#endif
}
@ -171,6 +172,18 @@ struct IssueListView: View {
)
}
}
#Preview("Issues Unavailable") {
NavigationStack {
IssueListView(
preview: (),
repository: .preview,
authService: .previewDefault,
issues: [],
notFound: true,
)
}
}
#endif
struct IssueRow: View {