Skip to content

Commit

Permalink
fix: unit tests around category "beverages" (#896)
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurtanuki authored Mar 29, 2024
1 parent 17ab121 commit 40e8966
Showing 1 changed file with 37 additions and 27 deletions.
64 changes: 37 additions & 27 deletions test/api_get_save_product_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 40e8966

Please sign in to comment.