Skip to content

Commit bd8554a

Browse files
gnpricechrisbobbe
authored andcommitted
store test [nfc]: Clarify what prepareReload is doing
1 parent 874e3bf commit bd8554a

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

test/example_data.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,14 @@ PerAccountStore store({
981981
}
982982
const _store = store;
983983

984-
UpdateMachine updateMachine({Account? account, InitialSnapshot? initialSnapshot}) {
984+
UpdateMachine updateMachine({
985+
GlobalStore? globalStore,
986+
Account? account,
987+
InitialSnapshot? initialSnapshot,
988+
}) {
985989
initialSnapshot ??= _initialSnapshot();
986-
final store = _store(account: account, initialSnapshot: initialSnapshot);
990+
final store = _store(globalStore: globalStore,
991+
account: account, initialSnapshot: initialSnapshot);
987992
return UpdateMachine.fromInitialSnapshot(
988993
store: store, initialSnapshot: initialSnapshot);
989994
}

test/model/store_test.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -999,16 +999,20 @@ void main() {
999999

10001000
Future<void> prepareReload(FakeAsync async) async {
10011001
globalStore = LoadingTestGlobalStore(accounts: [eg.selfAccount]);
1002+
1003+
// Simulate the setup that [TestGlobalStore.doLoadPerAccount] would do.
1004+
// (These tests use [LoadingTestGlobalStore] for greater control in
1005+
// later steps; that requires this setup step to be finer-grained too.)
1006+
final updateMachine = eg.updateMachine(
1007+
globalStore: globalStore, account: eg.selfAccount);
1008+
final store = updateMachine.store;
10021009
final future = globalStore.perAccount(eg.selfAccount.id);
1003-
final store = eg.store(globalStore: globalStore, account: eg.selfAccount);
10041010
completers().single.complete(store);
10051011
await future;
10061012
completers().clear();
1007-
final updateMachine = UpdateMachine.fromInitialSnapshot(
1008-
store: store, initialSnapshot: eg.initialSnapshot());
1013+
10091014
updateMachine.debugPauseLoop();
10101015
updateMachine.poll();
1011-
10121016
(store.connection as FakeApiConnection).prepare(
10131017
apiException: eg.apiExceptionBadEventQueueId());
10141018
updateMachine.debugAdvanceLoop();

0 commit comments

Comments
 (0)