Skip to content

Commit

Permalink
chore: test data changed (openfoodfacts#882)
Browse files Browse the repository at this point in the history
* chore: test data changed

* minor data fix
  • Loading branch information
monsieurtanuki authored Feb 13, 2024
1 parent 990cc67 commit cdc4899
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
30 changes: 14 additions & 16 deletions test/api_get_product_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ void main() {
'Invertzuckersirup',
'natürliches Aroma',
'Schokolade Mürbegebäck',
'Pflanzenfett',
'Palm',
'PflanzenPalmfett',
'Schokoladenstückchen',
'Kakaomasse',
'Kakaobutter',
Expand Down Expand Up @@ -854,22 +853,21 @@ void main() {
test(
'vegan, vegetarian and palm oil ingredients of Danish Butter Cookies & Chocolate Chip Cookies',
() async {
String barcode = BARCODE_DANISH_BUTTER_COOKIES;
ProductQueryConfiguration configurations = ProductQueryConfiguration(
barcode,
language: OpenFoodFactsLanguage.GERMAN,
fields: [ProductField.ALL],
version: ProductQueryVersion.v3,
);
ProductResultV3 result = await OpenFoodAPIClient.getProductV3(
configurations,
final ProductResultV3 result = await OpenFoodAPIClient.getProductV3(
ProductQueryConfiguration(
'3017620429484',
language: OpenFoodFactsLanguage.FRENCH,
fields: [ProductField.ALL],
version: ProductQueryVersion.v3,
),
);

final vegetableFat = result.product!.ingredients!
.firstWhere((ingredient) => ingredient.text == 'Pflanzenfett');
expect(vegetableFat.vegan, IngredientSpecialPropertyStatus.POSITIVE);
expect(vegetableFat.vegetarian, IngredientSpecialPropertyStatus.POSITIVE);
expect(vegetableFat.fromPalmOil, IngredientSpecialPropertyStatus.MAYBE);
final Ingredient ingredient = result.product!.ingredients!.firstWhere(
(ingredient) => ingredient.text == 'huile de palme',
);
expect(ingredient.vegan, IngredientSpecialPropertyStatus.POSITIVE);
expect(ingredient.vegetarian, IngredientSpecialPropertyStatus.POSITIVE);
expect(ingredient.fromPalmOil, IngredientSpecialPropertyStatus.POSITIVE);
});

test('get knowledge panels', () async {
Expand Down
4 changes: 2 additions & 2 deletions test/api_matched_product_v2_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void main() {
BARCODE_CHIPOLATA: _Score(100, MatchedProductStatusV2.VERY_GOOD_MATCH),
BARCODE_FLEISCHWURST: _Score(100, MatchedProductStatusV2.VERY_GOOD_MATCH),
BARCODE_POULET: _Score(0, MatchedProductStatusV2.UNKNOWN_MATCH),
BARCODE_SAUCISSON: _Score(0, MatchedProductStatusV2.DOES_NOT_MATCH),
BARCODE_SAUCISSON: _Score(0, MatchedProductStatusV2.UNKNOWN_MATCH),
BARCODE_PIZZA: _Score(0, MatchedProductStatusV2.DOES_NOT_MATCH),
BARCODE_ARDECHE: _Score(0, MatchedProductStatusV2.DOES_NOT_MATCH),
BARCODE_CHORIZO: _Score(0, MatchedProductStatusV2.DOES_NOT_MATCH),
Expand All @@ -69,8 +69,8 @@ void main() {
BARCODE_ORIENTALES,
BARCODE_HACK,
BARCODE_SCHNITZEL,
BARCODE_POULET,
BARCODE_SAUCISSON,
BARCODE_POULET,
BARCODE_PIZZA,
BARCODE_ARDECHE,
BARCODE_CHORIZO,
Expand Down

0 comments on commit cdc4899

Please sign in to comment.