Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msglist tests: Use Redux state in inputs, not background data #5290

Merged
merged 5 commits into from
Mar 15, 2022

Commits on Mar 15, 2022

  1. Configuration menu
    Copy the full SHA
    ca4c8cf View commit details
    Browse the repository at this point in the history
  2. msglist tests: Fix flake; make test data more representative

    One of the `check` functions hasn't been using our `baseState` that
    we put together with stream1 and stream2, to give background for the
    messages in those streams (streamMessages1, streamMessages2, etc.)
    that we pass to `check`.
    
    So, use that `baseState`.
    
    Also, the question of whether those streams are subscribed has
    effectively been left up to chance: if `eg.plusReduxState` *happens*
    to have a `subscriptions` entry for stream1 or stream2 (i.e., one
    where the stream_id matches), then we render a stream header as
    "subscribed"; otherwise not [1]. `eg.plusReduxState` currently has
    two `subscriptions` entries, both with random stream_ids. Most of
    the time they differ from stream1 and stream2 (effectively making
    those streams "unsubscribed"), but we saw a flake in CI for zulip#5290
    where they must've collided.
    
    Settle the question by saying the streams are actually subscribed,
    which is the common case.
    
    [1] If "subscribed", the background color is the stream's color
        (#123456 in current example data); otherwise, the fallback
        hsl(0, 0%, 80%). And the text color is
        `foregroundColorFromBackground` of that.
    chrisbobbe committed Mar 15, 2022
    Configuration menu
    Copy the full SHA
    932c28d View commit details
    Browse the repository at this point in the history
  3. msglist tests: Remove some accidental clobbering of plusReduxState

    On principle; not because there's anything in these particular
    fields that we really want. The principle is that we strictly want
    to add to the "standard example data" that `plusReduxState` exists
    to offer; we have no reason to erase or corrupt it.
    chrisbobbe committed Mar 15, 2022
    Configuration menu
    Copy the full SHA
    371e9b4 View commit details
    Browse the repository at this point in the history
  4. msglist tests: Use stream1 in single-messages tests

    The previous stream object was in an awkward in-between position:
    its ID happened to match the `stream1` and `stream1`'s subscription
    in the state (`baseState`) that the `check` function used as a
    default. But the stream's name differed in an arbitrary and
    unimportant way. (Both stream objects are "nonrandom" enough for
    current purposes.)
    
    So, just use `stream1`.
    chrisbobbe committed Mar 15, 2022
    Configuration menu
    Copy the full SHA
    137c020 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    51b582f View commit details
    Browse the repository at this point in the history