Skip to content

Commit

Permalink
Extend tests for code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rekire committed Apr 9, 2024
1 parent 7bfffb7 commit 0868f4e
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions autologin_windows/test/autologin_windows_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -18,7 +18,7 @@ void main() {
platform: autologin,
);

setUp(utils.clearCallLog);
setUp(() => autologin.setup(appName: 'demo app'));

test('can be registered', () {
AutologinWindows.registerWith();
Expand All @@ -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,
Expand All @@ -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),
),
);
});
}

0 comments on commit 0868f4e

Please sign in to comment.