Skip to content

Commit 9a9d08b

Browse files
gnpricechrisbobbe
authored andcommitted
store test [nfc]: Clarify what prepareReload is doing
1 parent e8a9a80 commit 9a9d08b

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

test/example_data.dart

+7-2
Original file line numberDiff line numberDiff line change
@@ -968,9 +968,14 @@ PerAccountStore store({
968968
}
969969
const _store = store;
970970

971-
UpdateMachine updateMachine({Account? account, InitialSnapshot? initialSnapshot}) {
971+
UpdateMachine updateMachine({
972+
GlobalStore? globalStore,
973+
Account? account,
974+
InitialSnapshot? initialSnapshot,
975+
}) {
972976
initialSnapshot ??= _initialSnapshot();
973-
final store = _store(account: account, initialSnapshot: initialSnapshot);
977+
final store = _store(globalStore: globalStore,
978+
account: account, initialSnapshot: initialSnapshot);
974979
return UpdateMachine.fromInitialSnapshot(
975980
store: store, initialSnapshot: initialSnapshot);
976981
}

test/model/store_test.dart

+8-4
Original file line numberDiff line numberDiff line change
@@ -972,16 +972,20 @@ void main() {
972972

973973
Future<void> prepareReload(FakeAsync async) async {
974974
globalStore = LoadingTestGlobalStore(accounts: [eg.selfAccount]);
975+
976+
// Simulate the setup that [TestGlobalStore.doLoadPerAccount] would do.
977+
// (These tests use [LoadingTestGlobalStore] for greater control in
978+
// later steps; that requires this setup step to be finer-grained too.)
979+
final updateMachine = eg.updateMachine(
980+
globalStore: globalStore, account: eg.selfAccount);
981+
final store = updateMachine.store;
975982
final future = globalStore.perAccount(eg.selfAccount.id);
976-
final store = eg.store(globalStore: globalStore, account: eg.selfAccount);
977983
completers().single.complete(store);
978984
await future;
979985
completers().clear();
980-
final updateMachine = UpdateMachine.fromInitialSnapshot(
981-
store: store, initialSnapshot: eg.initialSnapshot());
986+
982987
updateMachine.debugPauseLoop();
983988
updateMachine.poll();
984-
985989
(store.connection as FakeApiConnection).prepare(
986990
apiException: eg.apiExceptionBadEventQueueId());
987991
updateMachine.debugAdvanceLoop();

0 commit comments

Comments
 (0)