From cabd318d21340702ce4745b1aaa70981467d0660 Mon Sep 17 00:00:00 2001 From: Dowen Date: Sat, 4 Jun 2022 14:19:29 +0800 Subject: [PATCH] fix: :white_check_mark: fix mocking for new version --- .../test/app_updater_repository_test.dart | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/app_updater_repository/test/app_updater_repository_test.dart b/packages/app_updater_repository/test/app_updater_repository_test.dart index afb0c19..de41ef7 100644 --- a/packages/app_updater_repository/test/app_updater_repository_test.dart +++ b/packages/app_updater_repository/test/app_updater_repository_test.dart @@ -34,7 +34,7 @@ void main() { }); test('throws DioError by wrong github fetching', () async { - when(() => dio.get(captureAny())) + when(() => dio.get(captureAny())) .thenThrow(DioError(requestOptions: RequestOptions(path: ''))); expect( () => repository.hasGreaterVersion(version: '1.2.3'), @@ -42,7 +42,7 @@ void main() { ); expect( - verify(() => dio.get(captureAny())).captured, + verify(() => dio.get(captureAny())).captured, [ 'https://raw.githubusercontent.com/MinecraftCube/MinecraftCubeDesktop/version_info/version' ], @@ -51,7 +51,7 @@ void main() { test('return false when data is null', () async { final Response response = MockResponse(); - when(() => dio.get(any())).thenAnswer((_) async => response); + when(() => dio.get(any())).thenAnswer((_) async => response); when(() => response.data).thenReturn(null); expect( @@ -62,7 +62,7 @@ void main() { test('throws FormatException by unexpected online version', () async { final Response response = MockResponse(); - when(() => dio.get(any())).thenAnswer((_) async => response); + when(() => dio.get(any())).thenAnswer((_) async => response); when(() => response.data).thenReturn('sakjdasksaj'); expect( @@ -74,7 +74,7 @@ void main() { test('return true when online version is greater than app version', () async { final Response response = MockResponse(); - when(() => dio.get(any())).thenAnswer((_) async => response); + when(() => dio.get(any())).thenAnswer((_) async => response); when(() => response.data).thenReturn('1.2.4'); expect( @@ -88,7 +88,7 @@ void main() { test( 'throws DioError when there is no release note for specified country&lang.', () { - when(() => dio.get(captureAny())) + when(() => dio.get(captureAny())) .thenThrow(DioError(requestOptions: RequestOptions(path: ''))); expect( () => repository.getLatestRelease(fullLocale: 'test'), @@ -101,7 +101,7 @@ void main() { 'return null', () async { final Response response = MockResponse(); - when(() => dio.get(any())).thenAnswer((_) async => response); + when(() => dio.get(any())).thenAnswer((_) async => response); when(() => response.data).thenReturn(null); expect( await repository.getLatestRelease(fullLocale: 'test'), @@ -114,7 +114,7 @@ void main() { 'return content', () async { final Response response = MockResponse(); - when(() => dio.get(any())).thenAnswer((_) async => response); + when(() => dio.get(any())).thenAnswer((_) async => response); when(() => response.data).thenReturn('markdownContent'); expect( await repository.getLatestRelease(fullLocale: 'test'),