Implemented the previews for the FeedViewController view controller in the Feed framework.

This commit is contained in:
Javier Cicchelli 2024-03-19 09:27:53 +01:00
parent 5bd1de11e4
commit 08acf467a5

View File

@ -144,3 +144,57 @@ private extension String {
static let feedItem = "FeedItemCell"
}
}
// MARK: - Previews
#if DEBUG
import ReviewsFoundationKit
import ReviewsiTunesKit
@available(iOS 17.0, *)
#Preview("Feed View Controller with few reviews") {
MockURLProtocol.response = .init(
statusCode: 200,
object: Feed(entries: [
.init(
id: 1,
author: "Some author name #1 here",
title: "Some review title #1 goes here...",
content: "Some long, explanatory review comment #1 goes here...",
rating: 3,
version: "v1.0.0",
updated: .init()
),
.init(
id: 2,
author: "Some author name #2 here",
title: "Some review title #2 goes here...",
content: "Some long, explanatory review comment #2 goes here...",
rating: 5,
version: "v1.0.0",
updated: .init()
),
.init(
id: 3,
author: "Some author name #3 here",
title: "Some review title #3 goes here...",
content: "Some long, explanatory review comment #3 goes here...",
rating: 1,
version: "v1.0.0",
updated: .init()
),
])
)
return FeedViewController(configuration: .init(session: .mock))
}
@available(iOS 17.0, *)
#Preview("Feed View Controller with no reviews") {
MockURLProtocol.response = .init(
statusCode: 200,
object: Feed(entries: [])
)
return FeedViewController(configuration: .init(session: .mock))
}
#endif