Should have unit even if not given by OFF

This commit is contained in:
cdricms
2025-12-06 19:31:18 +01:00
parent dd191b585d
commit b419e8c620
3 changed files with 7387 additions and 2 deletions

View File

@@ -34,13 +34,18 @@ final class OpenFoodFactsTests: XCTestCase {
func testSearch() async throws {
let response = try await client.search(
.query("chocolate"),
.query("Peanut butter"),
// .tag(tag: .brands, value: "milka"),
.pageSize(5),
// .sort(.popularity),
)
let results = response.hits
let a = results.compactMap { $0.nutriments }
print(
a.compactMap { b in
b.fat.per100gUnitValue
})
let jsonResults = try JSONEncoder().encode(results)
try jsonResults.write(to: .init(filePath: "./jsonResults.json"))