Should work

This commit is contained in:
cdricms
2025-12-06 17:56:19 +01:00
parent 15fbc7b218
commit 62ad13cb8c
2 changed files with 7 additions and 5 deletions

View File

@@ -137,13 +137,15 @@ public struct ProductResponseEnvelope: Sendable, Decodable {
} }
public struct SearchResponseEnvelope: Sendable, Decodable { public struct SearchResponseEnvelope: Sendable, Decodable {
public let count: Int? public let count: Int
public let page: Int? public let page: Int
public let pageSize: Int? public let pageSize: Int
public let products: [Product]? public let products: [Product]
public let pageCount: Int
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case count, page, products case count, page, products
case pageSize = "page_size" case pageSize = "page_size"
case pageCount = "page_count"
} }
} }

View File

@@ -40,7 +40,7 @@ final class OpenFoodFactsTests: XCTestCase {
.sort(.popularity), .sort(.popularity),
) )
let results = response.products ?? [] let results = response.products
let jsonResults = try JSONEncoder().encode(results) let jsonResults = try JSONEncoder().encode(results)
try jsonResults.write(to: .init(filePath: "./jsonResults.json")) try jsonResults.write(to: .init(filePath: "./jsonResults.json"))