mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-13 11:53:41 +00:00
fix(web): wait for the saved analytics preference (#1656)
This commit is contained in:
1 parent
a34383a7e2
commit
392ee36137
3 files changed
+20
-2
No files matched your search
@@ -32,8 +32,22 @@ void main() {
|
||||
// The in-memory fallback still gets usable defaults.
|
||||
expect(config.downloadDir, '/downloads');
|
||||
expect(config.categories, hasLength(4));
|
||||
expect(config.extra.analyticsEnabled, isFalse);
|
||||
});
|
||||
|
||||
for (final analyticsEnabled in [false, true]) {
|
||||
test('preserves the saved analytics preference ($analyticsEnabled)', () async {
|
||||
final stored = configWith()..extra.analyticsEnabled = analyticsEnabled;
|
||||
final config = await loadDownloaderConfig(
|
||||
load: () async => stored,
|
||||
save: (_) async {},
|
||||
defaultDownloadDir: () async => '/downloads',
|
||||
);
|
||||
|
||||
expect(config.extra.analyticsEnabled, analyticsEnabled);
|
||||
});
|
||||
}
|
||||
|
||||
test('skips persist when init changed nothing', () async {
|
||||
var saved = 0;
|
||||
await loadDownloaderConfig(
|
||||
|
||||
Reference in new issue
Block a user