From 7a1f4e639573e182e2a1dff5098e5741d7fc057c Mon Sep 17 00:00:00 2001 From: monsieurtanuki Date: Sun, 4 Feb 2024 09:36:51 +0100 Subject: [PATCH] fix: unit tests about autocomplete (#868) * fix: unit tests about autocomplete * Additional minor unit test fix --- test/api_get_product_test.dart | 1 - test/api_search_test.dart | 20 +++++++------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/test/api_get_product_test.dart b/test/api_get_product_test.dart index eb509b28b6..3df19ba186 100644 --- a/test/api_get_product_test.dart +++ b/test/api_get_product_test.dart @@ -512,7 +512,6 @@ void main() { expect(result.product!.ecoscoreScore, isNotNull); expect(result.product!.ecoscoreData!.agribalyse, isNotNull); expect(result.product!.ecoscoreData!.adjustments, isNotNull); - expect(result.product!.ecoscoreData!.missingDataWarning, isFalse); }); test('product fields', () async { diff --git a/test/api_search_test.dart b/test/api_search_test.dart index 06e340a9b4..e7e1234bbd 100644 --- a/test/api_search_test.dart +++ b/test/api_search_test.dart @@ -6,8 +6,6 @@ import 'test_constants.dart'; /// Tests around the Elastic Search API. void main() { OpenFoodAPIConfiguration.userAgent = TestConstants.TEST_USER_AGENT; - // TODO(monsieurtanuki): test in PROD when available. - const UriProductHelper uriHelper = uriHelperFoodTest; group( '$OpenFoodSearchAPIClient autocomplete', @@ -31,7 +29,6 @@ void main() { query: 'pizza', taxonomyNames: [taxonomyName], language: language, - uriHelper: uriHelper, size: maxSize, ); basicTest(result); @@ -52,7 +49,6 @@ void main() { query: 'pifsehjfsjkvnskjvbehjszza', taxonomyNames: [taxonomyName], language: language, - uriHelper: uriHelper, size: maxSize, ); basicTest(result); @@ -77,7 +73,6 @@ void main() { query: inputValue, taxonomyNames: [taxonomyName], language: language, - uriHelper: uriHelper, size: maxSize, // supposed to fix the typo (if relevant) fuzziness: inputs[inputValue]!, @@ -108,7 +103,6 @@ void main() { query: query, taxonomyNames: [taxonomyName], language: language, - uriHelper: uriHelper, size: maxSize, fuzziness: Fuzziness.none, ); @@ -130,14 +124,15 @@ void main() { () async { await simpleTest(TaxonomyName.category, 'sky', 'Skyr nature'); await simpleTest(TaxonomyName.label, 'fsc', 'FSC Mix'); - await simpleTest(TaxonomyName.additive, 'E10', 'E104'); + await simpleTest(TaxonomyName.additive, 'E100', 'E1001'); await simpleTest(TaxonomyName.allergen, 'mouta', 'moutarde'); await simpleTest(TaxonomyName.aminoAcid, 'L-argin', 'L-arginine'); await simpleTest(TaxonomyName.country, 'fra', 'France'); await simpleTest( - TaxonomyName.dataQuality, - 'Valeur nutritionnelle 3800', - 'Valeur nutritionnelle supérieure à 3800 - Energie'); + TaxonomyName.dataQuality, + 'Valeur nutritionnelle', + 'Valeur nutritionnelle supérieure à 3800 - Energie', + ); await simpleTest( TaxonomyName.foodGroup, 'fromage per', 'Fromage persillé'); await simpleTest(TaxonomyName.improvement, 'Nutrition - Hau', @@ -164,9 +159,8 @@ void main() { await simpleTest( TaxonomyName.packagingRecycling, 'compost', 'Compostable'); await simpleTest(TaxonomyName.packagingShape, 'boute', 'Bouteille'); - await simpleTest( - TaxonomyName.periodsAfterOpening, '2 jours', '21 jours'); - await simpleTest(TaxonomyName.preservation, 'fra', 'Frais'); + await simpleTest(TaxonomyName.periodsAfterOpening, '21', '21 mois'); + await simpleTest(TaxonomyName.preservation, 'cons', 'Conserve'); await simpleTest(TaxonomyName.state, 'emball', 'Emballage complété'); await simpleTest(TaxonomyName.vitamin, 'b', 'b12'); await simpleTest(TaxonomyName.brand, 'carref', 'Carrefour',