Skip to content

Commit 580474b

Browse files
gnpricechrisbobbe
authored andcommitted
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: #1386 (comment)
1 parent c9cae02 commit 580474b

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

test/example_data.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -885,16 +885,12 @@ GlobalSettingsData globalSettings({
885885
themeSetting: themeSetting,
886886
);
887887
}
888-
const _globalSettings = globalSettings;
889888

890889
TestGlobalStore globalStore({
891890
GlobalSettingsData? globalSettings,
892891
List<Account> accounts = const [],
893892
}) {
894-
return TestGlobalStore(
895-
globalSettings: globalSettings ?? _globalSettings(),
896-
accounts: accounts,
897-
);
893+
return TestGlobalStore(globalSettings: globalSettings, accounts: accounts);
898894
}
899895
const _globalStore = globalStore;
900896

test/model/store_test.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,9 +1152,7 @@ void main() {
11521152
}
11531153

11541154
class LoadingTestGlobalStore extends TestGlobalStore {
1155-
LoadingTestGlobalStore({
1156-
required super.accounts,
1157-
}) : super(globalSettings: eg.globalSettings());
1155+
LoadingTestGlobalStore({required super.accounts});
11581156

11591157
Map<int, List<Completer<PerAccountStore>>> completers = {};
11601158

test/model/test_store.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ import '../example_data.dart' as eg;
2323
///
2424
/// See also [TestZulipBinding.globalStore], which provides one of these.
2525
class TestGlobalStore extends GlobalStore {
26-
TestGlobalStore({required super.globalSettings, required super.accounts});
26+
TestGlobalStore({
27+
GlobalSettingsData? globalSettings,
28+
required super.accounts,
29+
}) : super(globalSettings: globalSettings ?? eg.globalSettings());
2730

2831
@override
2932
Future<void> doUpdateGlobalSettings(GlobalSettingsCompanion data) async {

0 commit comments

Comments
 (0)