File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,7 +71,9 @@ class SilentUpdateNotification extends UpdatiumNotification {
7171 'appsUpdatedNotifDescription' .t (),
7272 Importance .defaultImportance,
7373 ) {
74- message = updates.length == 1
74+ message = updates.isEmpty
75+ ? ''
76+ : updates.length == 1
7577 ? t (
7678 succeeded ? 'xWasUpdatedToY' : 'xWasNotUpdatedToY' ,
7779 args: [updates[0 ].finalName, updates[0 ].latestVersion],
@@ -95,7 +97,9 @@ class SilentUpdateAttemptNotification extends UpdatiumNotification {
9597 'appsPossiblyUpdatedNotifDescription' .t (),
9698 Importance .defaultImportance,
9799 ) {
98- message = updates.length == 1
100+ message = updates.isEmpty
101+ ? ''
102+ : updates.length == 1
99103 ? t (
100104 'xWasPossiblyUpdatedToY' ,
101105 args: [updates[0 ].finalName, updates[0 ].latestVersion],
Original file line number Diff line number Diff line change 11import 'package:flutter_test/flutter_test.dart' ;
22import 'package:updatium/app_sources/html.dart' ;
33import 'package:updatium/providers/apps_provider.dart' ;
4+ import 'package:updatium/providers/notifications_provider.dart' ;
45import 'package:updatium/providers/settings_provider.dart' ;
56import 'package:updatium/providers/source_provider.dart' ;
67
@@ -291,4 +292,13 @@ void main() {
291292 expect (filtered.first.key, contains ('x86' ));
292293 });
293294 });
295+
296+ group ('Notification Tests' , () {
297+ test ('Update notifications can be built with no apps' , () {
298+ // Used to grab notification IDs for cancellation after an install
299+ expect (() => UpdateNotification ([]), returnsNormally);
300+ expect (() => SilentUpdateNotification ([], true ), returnsNormally);
301+ expect (() => SilentUpdateAttemptNotification ([], id: 1 ), returnsNormally);
302+ });
303+ });
294304}
You can’t perform that action at this time.
0 commit comments