diff --git a/lib/src/model/user.dart b/lib/src/model/user.dart index d1b9c3f263..5257ca6b34 100644 --- a/lib/src/model/user.dart +++ b/lib/src/model/user.dart @@ -27,4 +27,11 @@ class User extends JsonObject { @override Map toJson() => _$UserToJson(this); + + static String getUserWikiPage(final String userId) => Uri( + scheme: 'https', + host: 'wiki.openfoodfacts.org', + path: 'User:' + '${userId.substring(0, 1).toUpperCase()}${userId.substring(1)}', + ).toString(); } diff --git a/test/api_get_save_product_test.dart b/test/api_get_save_product_test.dart index b8826deb8a..584a7fd7af 100644 --- a/test/api_get_save_product_test.dart +++ b/test/api_get_save_product_test.dart @@ -65,7 +65,7 @@ void main() { final String barcode = getBookBarcode(0); const OpenFoodFactsLanguage language = OpenFoodFactsLanguage.GERMAN; - const String genericName = 'Softdrink'; + const String genericName = 'Softdrink beverage'; const List ingredientsText = [ 'Wasser', 'Kohlensäure', @@ -711,7 +711,7 @@ void main() { } const String barcode = '111111555555'; - const String genericName = 'Softdrink'; + const String genericName = 'Softdrink beverage'; const String labels = 'MyTestLabel'; const String quantity = '5.5 Liter'; diff --git a/test/user_management_test_prod.dart b/test/user_management_test_prod.dart index 4408184f8c..99f20fc4a6 100644 --- a/test/user_management_test_prod.dart +++ b/test/user_management_test_prod.dart @@ -185,6 +185,15 @@ void main() { expect(status.status, koStatus); }); }); + + group('wiki page', () { + test('user wiki page', () async { + expect( + User.getUserWikiPage('teolemon'), + 'https://wiki.openfoodfacts.org/User:Teolemon', + ); + }); + }); } String _generateRandomString(int length) {