From f8075ad515c8e334551f4dfc1544576926c52576 Mon Sep 17 00:00:00 2001 From: Dante291 Date: Sun, 19 Nov 2023 20:15:38 +0530 Subject: [PATCH] fixing failing tets --- test/helpers/test_helpers.dart | 40 +++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/test/helpers/test_helpers.dart b/test/helpers/test_helpers.dart index 790d5e2d3..55e967133 100644 --- a/test/helpers/test_helpers.dart +++ b/test/helpers/test_helpers.dart @@ -250,25 +250,31 @@ GraphQLClient getAndRegisterGraphQLClient() { // Either fill this with mock data or override this stub // and return null - when( - service.query( - QueryOptions( - document: gql(queries.getPluginsList()), - ), - ), - ).thenAnswer( + when(service.query(any)).thenAnswer( (realInvocation) async { - return Future.value( - QueryResult( - source: QueryResultSource.network, - data: { - "getPlugins": null, - }, - options: QueryOptions( - document: gql(queries.getPluginsList()), + 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()), + ), + ), + ); + } }, );