mirror of
https://github.com/kuhyx/wake-alarm.git
synced 2026-11-26 17:37:13 +01:00
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,free-days-interop) (push) Waiting to run
Tests / test (push) Waiting to run
Tests / free-days-interop (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
The home screen prefixed it to every publish() result, including the full-screen-intent refusal and sync errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
1.7 KiB
Dart
53 lines
1.7 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:wake_alarm_sync/services/alarm_publisher.dart';
|
|
|
|
import '../fake_secure_storage.dart';
|
|
|
|
void main() {
|
|
TestWidgetsFlutterBinding.ensureInitialized();
|
|
|
|
setUp(() {
|
|
installFakeSecureStorage();
|
|
SharedPreferences.setMockInitialValues(<String, Object>{});
|
|
});
|
|
|
|
test('an unconfigured install is told to connect a backend', () async {
|
|
final message = await AlarmPublisher().publish(
|
|
service: null,
|
|
hour: 8,
|
|
minute: 0,
|
|
);
|
|
expect(message, contains('Connect a sync backend'));
|
|
});
|
|
|
|
test('a missing store is not reported as a missing backend', () async {
|
|
// The regression this guards. Both causes used to return the same
|
|
// "connect a backend" line, so a store that failed to open looked like a
|
|
// setup step the user had never done — while Firebase was connected the
|
|
// whole time and the real fault was a null service. The advice pointed at
|
|
// something that was not broken, and nothing published for weeks.
|
|
SharedPreferences.setMockInitialValues(<String, Object>{
|
|
'github_token': 'ghp_configured',
|
|
});
|
|
final message = await AlarmPublisher().publish(
|
|
service: null,
|
|
hour: 8,
|
|
minute: 0,
|
|
);
|
|
expect(message, isNot(contains('Connect a sync backend')));
|
|
expect(message, contains('Sync store unavailable'));
|
|
});
|
|
|
|
test('the Clock line names the time only when the handoff completed', () {
|
|
expect(
|
|
syncedStatus(6, 5, inClock: true),
|
|
'Armed for 06:05. Synced to PC ✓ Clock app set ✓',
|
|
);
|
|
expect(
|
|
syncedStatus(6, 5, inClock: false),
|
|
'Armed for 06:05. Synced to PC ✓',
|
|
);
|
|
});
|
|
}
|