From 0868f4ed759783720ede2eb65af584992cac5b9e Mon Sep 17 00:00:00 2001 From: rekire Date: Tue, 9 Apr 2024 21:46:38 +0200 Subject: [PATCH] Extend tests for code coverage --- .../test/autologin_windows_test.dart | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/autologin_windows/test/autologin_windows_test.dart b/autologin_windows/test/autologin_windows_test.dart index 81227f9..d2fe9a5 100644 --- a/autologin_windows/test/autologin_windows_test.dart +++ b/autologin_windows/test/autologin_windows_test.dart @@ -8,7 +8,7 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); group('AutologinDarwin', () { - final autologin = AutologinWindows()..setup(appName: 'demo app'); + final autologin = AutologinWindows(); final utils = SharedTests( compatibilities: const Compatibilities( isPlatformSupported: true, @@ -18,7 +18,7 @@ void main() { platform: autologin, ); - setUp(utils.clearCallLog); + setUp(() => autologin.setup(appName: 'demo app')); test('can be registered', () { AutologinWindows.registerWith(); @@ -38,6 +38,11 @@ void main() { expect(result, equals(SharedTests.expectedCredentials)); }); + test('verify that non existing accounts return null', () async { + autologin.setup(appName: 'none existing app'); + expect(await autologin.requestCredentials(), equals(null)); + }); + test('saveLoginToken returns true', () async { final report = await autologin.saveCredentials( SharedTests.expectedCredentials, @@ -49,5 +54,13 @@ void main() { 'requestLoginToken returns expected value', () async => expect(await autologin.requestLoginToken(), equals(null)), ); + + test( + 'verify that save token fails', + () async => expect( + await autologin.saveLoginToken(SharedTests.expectedToken), + equals(false), + ), + ); }); }