import 'package:cloudreve4_flutter/services/update_service.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  group('UpdateService', () {
    test(
      'checkForUpdate releases checking flag when package info fails',
      () async {
        var calls = 0;
        final service = UpdateService.test(
          packageInfoProvider: () async {
            calls += 1;
            throw Exception('package info unavailable');
          },
        );

        expect(await service.checkForUpdate(), isNull);
        expect(await service.checkForUpdate(), isNull);
        expect(calls, 2);
      },
    );
  });
}
