diff --git a/test/async_test.dart b/test/async_test.dart index a25b28d..9c3e548 100644 --- a/test/async_test.dart +++ b/test/async_test.dart @@ -349,40 +349,34 @@ void main() { }); test('ready automatic signalling for async Singletons', () async { - try { - final getIt = GetIt.instance; - await getIt.reset(); + final getIt = GetIt.instance; + await getIt.reset(); - getIt.registerSingletonAsync( - () async => TestClass(internalCompletion: false).init(), - ); - getIt.registerSingletonAsync( - () async { - final instance = - TestClass2(internalCompletion: false, initMsDelay: 50); - await instance.init(); - return instance; - }, - ); - getIt.registerSingletonAsync( - () async => TestClass2(internalCompletion: false).init(), - instanceName: 'Second Instance', - ); + getIt.registerSingletonAsync( + () async => TestClass(internalCompletion: false).init(), + ); + getIt.registerSingletonAsync( + () async { + final instance = TestClass2(internalCompletion: false, initMsDelay: 50); + await instance.init(); + return instance; + }, + ); + getIt.registerSingletonAsync( + () async => TestClass2(internalCompletion: false).init(), + instanceName: 'Second Instance', + ); - expect(getIt.isReadySync(), false); - expect(getIt.isReadySync(), false); - expect( - getIt.isReadySync(instanceName: 'Second Instance'), false); + expect(getIt.isReadySync(), false); + expect(getIt.isReadySync(), false); + expect( + getIt.isReadySync(instanceName: 'Second Instance'), false); - await getIt.allReady(); + await getIt.allReady(); - expect(getIt.isReadySync(), true); - expect(getIt.isReadySync(), true); - expect( - getIt.isReadySync(instanceName: 'Second Instance'), true); - } on Exception catch (e) { - print(e); - } + expect(getIt.isReadySync(), true); + expect(getIt.isReadySync(), true); + expect(getIt.isReadySync(instanceName: 'Second Instance'), true); }); test('isReady propagates Error', () async {