You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
unreads test [nfc]: Accept that a whole PerAccountStore is used for tests
We've had a couple of approaches we've experimented with for how to write
the tests for a given substore within our data model:
* Operate on the given substore's individual API.
* Operate on the API of the overall PerAccountStore, though focusing on
the particular portion of that API provided by the given substore.
In general I think the outcome of these experiments is that we want to
be writing our tests against the API of the whole PerAccountStore.
Fundamentally that's for the reasons described here:
https://zulip.readthedocs.io/en/latest/testing/philosophy.html#integration-testing-or-unit-testing
because the overall PerAccountStore is the layer whose API corresponds
naturally to the Zulip server API, which is an interface that's
external to the app and so is the real interface we're committed to
supporting.
This particular test file is one which we originally wrote on the
other side of the experiment, operating on the individual `Unreads`
substore.
But it already had some tension with that approach, ever since we
realized that that substore needed access to another substore, the
ChannelStore, in order to properly handle muting (ffa2d32,
0d03c8e). To handle that, these tests ended up making a whole
PerAccountStore after all, and had a TODO comment for trying to
fully make the substore-only approach work.
With the advent of CorePerAccountStore, there's no longer a realistic
prospect that we'd want to end up carrying that through. That's
because the Unreads now gets its value of `selfUserId` from a
CorePerAccountStore, and the only reasonable way to construct one of
those is as part of a whole PerAccountStore.
So resolve the experiment, at least as to this file: remove the
TODO comment, and rename the variable to just `store` accordingly.
0 commit comments