Skip to content

Commit

Permalink
fix: unit tests about autocomplete (#868)
Browse files Browse the repository at this point in the history
* fix: unit tests about autocomplete

* Additional minor unit test fix
  • Loading branch information
monsieurtanuki authored Feb 4, 2024
1 parent f487ffc commit 7a1f4e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
1 change: 0 additions & 1 deletion test/api_get_product_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
20 changes: 7 additions & 13 deletions test/api_search_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -31,7 +29,6 @@ void main() {
query: 'pizza',
taxonomyNames: <TaxonomyName>[taxonomyName],
language: language,
uriHelper: uriHelper,
size: maxSize,
);
basicTest(result);
Expand All @@ -52,7 +49,6 @@ void main() {
query: 'pifsehjfsjkvnskjvbehjszza',
taxonomyNames: <TaxonomyName>[taxonomyName],
language: language,
uriHelper: uriHelper,
size: maxSize,
);
basicTest(result);
Expand All @@ -77,7 +73,6 @@ void main() {
query: inputValue,
taxonomyNames: <TaxonomyName>[taxonomyName],
language: language,
uriHelper: uriHelper,
size: maxSize,
// supposed to fix the typo (if relevant)
fuzziness: inputs[inputValue]!,
Expand Down Expand Up @@ -108,7 +103,6 @@ void main() {
query: query,
taxonomyNames: <TaxonomyName>[taxonomyName],
language: language,
uriHelper: uriHelper,
size: maxSize,
fuzziness: Fuzziness.none,
);
Expand All @@ -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',
Expand All @@ -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',
Expand Down

0 comments on commit 7a1f4e6

Please sign in to comment.