From ee2812e15213dfd8d07200ccb18424dd9f7db20e Mon Sep 17 00:00:00 2001 From: Greg Price Date: Tue, 11 Mar 2025 20:14:08 -0700 Subject: [PATCH] test [nfc]: Make globalSettings optional on TestGlobalStore This has a natural default, at least in tests, because most tests don't care about the specific value of the global settings. (By contrast most tests that interact with the store at all will care what set of accounts exist, so there isn't as natural a default for `accounts`.) Originally noticed this here: https://github.com/zulip/zulip-flutter/pull/1386#discussion_r1990358363 --- test/example_data.dart | 6 +----- test/model/store_test.dart | 4 +--- test/model/test_store.dart | 5 ++++- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/test/example_data.dart b/test/example_data.dart index 4785917814..97527f42db 100644 --- a/test/example_data.dart +++ b/test/example_data.dart @@ -885,16 +885,12 @@ GlobalSettingsData globalSettings({ themeSetting: themeSetting, ); } -const _globalSettings = globalSettings; TestGlobalStore globalStore({ GlobalSettingsData? globalSettings, List accounts = const [], }) { - return TestGlobalStore( - globalSettings: globalSettings ?? _globalSettings(), - accounts: accounts, - ); + return TestGlobalStore(globalSettings: globalSettings, accounts: accounts); } const _globalStore = globalStore; diff --git a/test/model/store_test.dart b/test/model/store_test.dart index 9d92285800..61b4ece5cf 100644 --- a/test/model/store_test.dart +++ b/test/model/store_test.dart @@ -1152,9 +1152,7 @@ void main() { } class LoadingTestGlobalStore extends TestGlobalStore { - LoadingTestGlobalStore({ - required super.accounts, - }) : super(globalSettings: eg.globalSettings()); + LoadingTestGlobalStore({required super.accounts}); Map>> completers = {}; diff --git a/test/model/test_store.dart b/test/model/test_store.dart index f119343b0f..ebf6e66f1b 100644 --- a/test/model/test_store.dart +++ b/test/model/test_store.dart @@ -23,7 +23,10 @@ import '../example_data.dart' as eg; /// /// See also [TestZulipBinding.globalStore], which provides one of these. class TestGlobalStore extends GlobalStore { - TestGlobalStore({required super.globalSettings, required super.accounts}); + TestGlobalStore({ + GlobalSettingsData? globalSettings, + required super.accounts, + }) : super(globalSettings: globalSettings ?? eg.globalSettings()); @override Future doUpdateGlobalSettings(GlobalSettingsCompanion data) async {