From 40e89666b70eb64de81c28e34d488bf16e7a9e96 Mon Sep 17 00:00:00 2001 From: monsieurtanuki Date: Fri, 29 Mar 2024 20:14:45 +0100 Subject: [PATCH] fix: unit tests around category "beverages" (#896) --- test/api_get_save_product_test.dart | 64 +++++++++++++++++------------ 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/test/api_get_save_product_test.dart b/test/api_get_save_product_test.dart index dd93ace1ec..096baa18f4 100644 --- a/test/api_get_save_product_test.dart +++ b/test/api_get_save_product_test.dart @@ -232,12 +232,13 @@ void main() { OpenFoodFactsLanguage.ENGLISH: englishIngredientsSplit, })); - expect(englishProduct.categoriesTags, equals([tagCategory])); + expect(englishProduct.categoriesTags, contains(tagCategory)); + expect(englishProduct.categoriesTagsInLanguages, isNotNull); expect( - englishProduct.categoriesTagsInLanguages, - equals({ - OpenFoodFactsLanguage.ENGLISH: [englishCategory] - })); + englishProduct + .categoriesTagsInLanguages![OpenFoodFactsLanguage.ENGLISH], + contains(englishCategory), + ); expect(englishProduct.countriesTags, equals([countryTag])); expect( @@ -266,12 +267,13 @@ void main() { OpenFoodFactsLanguage.RUSSIAN: russianIngredientsSplit, })); - expect(russianProduct.categoriesTags, equals([tagCategory])); + expect(russianProduct.categoriesTags, contains(tagCategory)); + expect(russianProduct.categoriesTagsInLanguages, isNotNull); expect( - russianProduct.categoriesTagsInLanguages, - equals({ - OpenFoodFactsLanguage.RUSSIAN: [russianCategory] - })); + russianProduct + .categoriesTagsInLanguages![OpenFoodFactsLanguage.RUSSIAN], + contains(russianCategory), + ); expect(russianProduct.countriesTags, equals([countryTag])); expect( @@ -372,12 +374,13 @@ void main() { OpenFoodFactsLanguage.ENGLISH: englishIngredientsSplit, })); - expect(englishProduct.categoriesTags, equals([tagCategory])); + expect(englishProduct.categoriesTags, contains(tagCategory)); + expect(englishProduct.categoriesTagsInLanguages, isNotNull); expect( - englishProduct.categoriesTagsInLanguages, - equals({ - OpenFoodFactsLanguage.ENGLISH: [englishCategory] - })); + englishProduct + .categoriesTagsInLanguages![OpenFoodFactsLanguage.ENGLISH], + contains(englishCategory), + ); expect(englishProduct.countriesTags, equals([countryTag])); expect( @@ -408,12 +411,13 @@ void main() { OpenFoodFactsLanguage.RUSSIAN: russianIngredientsSplit, })); - expect(russianProduct.categoriesTags, equals([tagCategory])); + expect(russianProduct.categoriesTags, contains(tagCategory)); + expect(russianProduct.categoriesTagsInLanguages, isNotNull); expect( - russianProduct.categoriesTagsInLanguages, - equals({ - OpenFoodFactsLanguage.RUSSIAN: [russianCategory] - })); + russianProduct + .categoriesTagsInLanguages![OpenFoodFactsLanguage.RUSSIAN], + contains(russianCategory), + ); expect(russianProduct.countriesTags, equals([countryTag])); expect( @@ -507,14 +511,20 @@ void main() { OpenFoodFactsLanguage.GERMAN: germanIngredientsSplit, })); - expect(product.categoriesTags, equals([tagCategory])); + expect(product.categoriesTags, contains(tagCategory)); + expect(product.categoriesTagsInLanguages, isNotNull); expect( - product.categoriesTagsInLanguages, - equals({ - OpenFoodFactsLanguage.ENGLISH: [englishCategory], - OpenFoodFactsLanguage.RUSSIAN: [russianCategory], - OpenFoodFactsLanguage.GERMAN: [germanCategory], - })); + product.categoriesTagsInLanguages![OpenFoodFactsLanguage.ENGLISH], + contains(englishCategory), + ); + expect( + product.categoriesTagsInLanguages![OpenFoodFactsLanguage.RUSSIAN], + contains(russianCategory), + ); + expect( + product.categoriesTagsInLanguages![OpenFoodFactsLanguage.GERMAN], + contains(germanCategory), + ); expect(product.countriesTags, equals([countryTag])); expect(