From 07cc2d1efcf807be212c42ede431d5ba7e8007b7 Mon Sep 17 00:00:00 2001 From: Parag Gupta <103507835+Dante291@users.noreply.github.com> Date: Mon, 20 Nov 2023 19:50:51 +0530 Subject: [PATCH 1/5] fetch plugin list test (#2115) * fetch plugin list test * test helpers * fixing workflow * fixing workflow * fixing failing test * fixing failing tets --- test/helpers/test_helpers.dart | 40 +++++++---- test/plugins/fetch_plugin_list_test.dart | 86 ++++++++++++++++++++++++ 2 files changed, 113 insertions(+), 13 deletions(-) create mode 100644 test/plugins/fetch_plugin_list_test.dart diff --git a/test/helpers/test_helpers.dart b/test/helpers/test_helpers.dart index 763c1b070..55e967133 100644 --- a/test/helpers/test_helpers.dart +++ b/test/helpers/test_helpers.dart @@ -250,19 +250,33 @@ GraphQLClient getAndRegisterGraphQLClient() { // Either fill this with mock data or override this stub // and return null - // when(service.query(QueryOptions( - // document: gql(queries.getPluginsList()), - // ))).thenAnswer( - // (realInvocation) async { - // return QueryResult.internal( - // source: QueryResultSource.network, - // parserFn: (data) => {}, - // data: { - // "getPlugins": [], - // }, - // ); - // }, - // ); + when(service.query(any)).thenAnswer( + (realInvocation) async { + if (locator.isRegistered()) { + return Future.value( + QueryResult>( + source: QueryResultSource.network, + data: { + "getPlugins": null, + }, + options: QueryOptions( + document: gql(queries.getPluginsList()), + ), + ), + ); + } else { + return Future.value( + QueryResult>( + source: QueryResultSource.network, + data: null, + options: QueryOptions( + document: gql(queries.getPluginsList()), + ), + ), + ); + } + }, + ); when(service.defaultPolicies).thenAnswer( (realInvocation) => DefaultPolicies(), diff --git a/test/plugins/fetch_plugin_list_test.dart b/test/plugins/fetch_plugin_list_test.dart new file mode 100644 index 000000000..f8dc27d93 --- /dev/null +++ b/test/plugins/fetch_plugin_list_test.dart @@ -0,0 +1,86 @@ +import 'dart:io'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; +import 'package:hive/hive.dart'; +import 'package:mockito/mockito.dart'; +import 'package:talawa/plugins/fetch_plugin_list.dart'; +import 'package:talawa/services/graphql_config.dart'; + +import '../helpers/test_helpers.dart'; +import '../helpers/test_locator.dart'; + +/// Tests fetch_plugin_list.dart. +/// +/// more_info_if_required +/// +/// **params**: +/// None +/// +/// **returns**: +/// None +void main() async { + testSetupLocator(); + locator().test(); + late FetchPluginList fetchPluginList; + + final Directory dir = await Directory.systemTemp.createTemp('talawa_test'); + Hive.init(dir.path); + await Hive.openBox('pluginBox'); + + setUp(() { + registerServices(); + locator.allowReassignment = true; + + locator.registerLazySingleton(() => FetchPluginList()); + fetchPluginList = locator(); + }); + group('FetchPluginList', () { + test('fetchList should fetch plugins and store them in Hive', () async { + final queryResult = QueryResult( + data: { + 'getPlugins': [ + { + '_id': '1', + 'pluginName': 'Plugin 1', + 'pluginCreatedBy': 'User A', + 'pluginDesc': 'Description A', + 'pluginInstallStatus': true, + 'installedOrgs': ['Org A'], + }, + ], + }, + options: QueryOptions( + document: gql(queries.getPluginsList()), + ), + source: QueryResultSource.network, + ); + + when(locator().clientToQuery()).thenAnswer( + (_) => locator(), + ); + when( + locator().query( + QueryOptions( + document: gql(queries.getPluginsList()), + ), + ), + ).thenAnswer((_) async => queryResult); + await fetchPluginList.fetchList(); + + verify(locator().clientToQuery()).called(2); + verify( + locator().query( + QueryOptions( + document: gql(queries.getPluginsList()), + ), + ), + ).called(2); + + expect(fetchPluginList.box, isNotNull); + expect( + fetchPluginList.box.get('plugins'), + equals(queryResult.data!["getPlugins"]), + ); + }); + }); +} From a290c791611a596903898a75cffba67ce6fd8b1c Mon Sep 17 00:00:00 2001 From: Parag Gupta <103507835+Dante291@users.noreply.github.com> Date: Mon, 20 Nov 2023 19:51:23 +0530 Subject: [PATCH 2/5] Upgrading Mockito package (#2112) * Upgrading mockito * upgarding --- pubspec.lock | 4 ++-- pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index a57286507..eb2024a05 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1065,10 +1065,10 @@ packages: dependency: "direct main" description: name: mockito - sha256: "7d5b53bcd556c1bc7ffbe4e4d5a19c3e112b7e925e9e172dd7c6ad0630812616" + ha256: "4b693867cee1853c9d1d7ecc1871f27f39b2ef2c13c0d8d8507dfe5bebd8aaf1" url: "https://pub.dev" source: hosted - version: "5.4.2" + version: "5.4.3" mocktail: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 698c1e96a..3a586f307 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -62,7 +62,7 @@ dependencies: image_picker: ^1.0.4 intl: ^0.18.0 json_annotation: ^4.7.0 - mockito: ^5.4.2 + mockito: ^5.4.3 network_image_mock: ^2.1.1 path_provider: ^2.1.1 permission_handler: ^11.0.1 From fec1a2e1b015a19e6173bb5eb9bf5a102490445a Mon Sep 17 00:00:00 2001 From: Vaidic Dodwani <59657947+vaidic-dodwani@users.noreply.github.com> Date: Mon, 20 Nov 2023 19:52:08 +0530 Subject: [PATCH 3/5] Version update of Video Player to 2.8.1 (#2113) * Version update of Video Player to 2.8.1 * Modified: pubspec.lock --- pubspec.lock | 12 ++++++------ pubspec.yaml | 5 +---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index eb2024a05..9473299b4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1709,10 +1709,10 @@ packages: dependency: "direct main" description: name: video_player - sha256: "74b86e63529cf5885130c639d74cd2f9232e7c8a66cbecbddd1dcb9dbd060d1e" + sha256: e16f0a83601a78d165dabc17e4dac50997604eb9e4cc76e10fa219046b70cef3 url: "https://pub.dev" source: hosted - version: "2.7.2" + version: "2.8.1" video_player_android: dependency: transitive description: @@ -1725,10 +1725,10 @@ packages: dependency: transitive description: name: video_player_avfoundation - sha256: bf1a1322bf68bccd349982ba1f5a41314a3880861fb9a93d25d6d0a2345845f0 + sha256: bc923884640d6dc403050586eb40713cdb8d1d84e6886d8aca50ab04c59124c2 url: "https://pub.dev" source: hosted - version: "2.4.11" + version: "2.5.2" video_player_platform_interface: dependency: transitive description: @@ -1826,5 +1826,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.1.0-185.0.dev <3.13.0" - flutter: ">=3.10.0" + dart: ">=3.1.0 <3.13.0" + flutter: ">=3.13.0" diff --git a/pubspec.yaml b/pubspec.yaml index 3a586f307..16b77ccfa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,6 @@ description: Welcome to the Talawa Project for the Palisadoes Foundation publish_to: "none" # Remove this line if you wish to publish to pub.dev - version: 1.0.0+1 homepage: https://github.com/PalisadoesFoundation/talawa @@ -38,7 +37,6 @@ dependencies: firebase_messaging: ^14.7.3 firebase_messaging_platform_interface: ^4.5.13 - flutter: sdk: flutter flutter_braintree: ^3.0.0 @@ -81,10 +79,9 @@ dependencies: tutorial_coach_mark: ^1.2.9 uni_links: ^0.5.1 vibration: ^1.8.3 - video_player: ^2.7.2 + video_player: ^2.8.1 visibility_detector: ^0.4.0+2 - dev_dependencies: build_runner: ^2.4.6 custom_lint: 0.5.6 From e8129ce729681198bd0abecd4fd30c9402748f26 Mon Sep 17 00:00:00 2001 From: Ayush Raghuwanshi <62144720+AyushRaghuvanshi@users.noreply.github.com> Date: Mon, 20 Nov 2023 19:52:41 +0530 Subject: [PATCH 4/5] Modified:pubspec.yaml (#2116) --- pubspec.lock | 4 ++-- pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 9473299b4..1d05714b2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1281,10 +1281,10 @@ packages: dependency: "direct main" description: name: provider - sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f + sha256: "9a96a0a19b594dbc5bf0f1f27d2bc67d5f95957359b461cd9feb44ed6ae75096" url: "https://pub.dev" source: hosted - version: "6.0.5" + version: "6.1.1" pub_semver: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 16b77ccfa..606aa989b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -66,7 +66,7 @@ dependencies: permission_handler: ^11.0.1 plugin_platform_interface: ^2.1.7 pointycastle: ^3.7.3 - provider: ^6.0.3 + provider: ^6.1.1 qr_code_scanner: ^1.0.0 qr_flutter: 4.0.0 quick_actions: ^1.0.6 From a16f98207022e5643b621b6902baa4be8c620097 Mon Sep 17 00:00:00 2001 From: Parag Gupta <103507835+Dante291@users.noreply.github.com> Date: Tue, 21 Nov 2023 02:24:27 +0530 Subject: [PATCH 5/5] upgrading package (#2120) --- pubspec.lock | 6 +++--- pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 1d05714b2..48648cc4a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1065,7 +1065,7 @@ packages: dependency: "direct main" description: name: mockito - ha256: "4b693867cee1853c9d1d7ecc1871f27f39b2ef2c13c0d8d8507dfe5bebd8aaf1" + sha256: "4b693867cee1853c9d1d7ecc1871f27f39b2ef2c13c0d8d8507dfe5bebd8aaf1" url: "https://pub.dev" source: hosted version: "5.4.3" @@ -1542,10 +1542,10 @@ packages: dependency: "direct main" description: name: syncfusion_flutter_calendar - sha256: ebfbfc0a5cb842aac82e02dcab109ba4746abd8562ed00df98e57627e69c7c41 + sha256: cc8dcd9269fc836067d106a3985f8f4f0c71e397d995e074f02fa34f6d30c330 url: "https://pub.dev" source: hosted - version: "23.1.43" + version: "23.1.44" syncfusion_flutter_core: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 606aa989b..3af294c34 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -73,7 +73,7 @@ dependencies: shared_preferences: ^2.2.2 shimmer: ^3.0.0 social_share: ^2.2.1 - syncfusion_flutter_calendar: 23.1.43 + syncfusion_flutter_calendar: 23.1.44 syncfusion_flutter_datepicker: 23.1.44 timelines: ^0.1.0 tutorial_coach_mark: ^1.2.9