mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-21 06:52:18 +02:00
test(queue): remove real waits from the startup flush test
The startup flush test slept 1.24 s, mostly three 400 ms windows that must outlast the 350 ms persistence debounce. The body now runs in VirtualTime, so those waits and the debounce timer advance on virtual time while platform-channel replies stay real. No production change; the test body and assertions are unchanged.
This commit is contained in:
1 parent
31999a15c7
commit
8ef3bca69f
1 file changed
+5
-2
@@ -13,6 +13,7 @@ import 'package:spotiflac_android/providers/settings_provider.dart';
|
||||
import 'package:spotiflac_android/services/app_state_database.dart';
|
||||
|
||||
import 'support/fixed_settings.dart';
|
||||
import 'support/virtual_time.dart';
|
||||
|
||||
const _earlyTrack = Track(
|
||||
id: 'example:early',
|
||||
@@ -24,9 +25,11 @@ const _earlyTrack = Track(
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
// The waits run on virtual time, including the 350 ms persistence debounce
|
||||
// they must outlast.
|
||||
test(
|
||||
'startup restores, merges and retries only complete owned snapshots',
|
||||
() async {
|
||||
() => VirtualTime().run(() async {
|
||||
SharedPreferences.setMockInitialValues({
|
||||
'app_state_migrated_queue_to_sqlite_v1': true,
|
||||
'download_queue_user_paused_v1': true,
|
||||
@@ -407,6 +410,6 @@ void main() {
|
||||
expect([writes, deletes], [7, 0]);
|
||||
explicitRetry.dispose();
|
||||
await (await AppStateDatabase.instance.database).close();
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user