diff --git a/src/__tests__/lib/exampleData.js b/src/__tests__/lib/exampleData.js index f4e22170831..c7bf43085f8 100644 --- a/src/__tests__/lib/exampleData.js +++ b/src/__tests__/lib/exampleData.js @@ -2,7 +2,14 @@ import deepFreeze from 'deep-freeze'; import { createStore } from 'redux'; -import type { CrossRealmBot, Message, PmRecipientUser, Stream, User } from '../../api/modelTypes'; +import type { + CrossRealmBot, + Message, + PmRecipientUser, + Stream, + Subscription, + User, +} from '../../api/modelTypes'; import type { Action, GlobalState, RealmState } from '../../reduxTypes'; import type { Auth, Account, Outbox } from '../../types'; import { ZulipVersion } from '../../utils/zulipVersion'; @@ -178,6 +185,24 @@ export const stream: Stream = makeStream({ description: 'An example stream.', }); +export const makeSubscription = (args: { stream?: Stream } = {}): Subscription => { + const { stream: streamInner = stream } = args; + return deepFreeze({ + ...streamInner, + color: '#123456', + in_home_view: true, + pin_to_top: false, + audible_notifications: false, + desktop_notifications: false, + email_address: '??? make this value representative before using in a test :)', + is_old_stream: true, + push_notifications: null, + stream_weekly_traffic: 84, + }); +}; + +export const subscription: Subscription = makeSubscription(); + /* ======================================================================== * Messages */ diff --git a/src/message/__tests__/messageActionSheet-test.js b/src/message/__tests__/messageActionSheet-test.js index a0fa2551464..cd601cc4300 100644 --- a/src/message/__tests__/messageActionSheet-test.js +++ b/src/message/__tests__/messageActionSheet-test.js @@ -31,20 +31,7 @@ const baseBackgroundData = deepFreeze({ }, mute: [['announce', 'stream events']], ownUser: eg.selfUser, - subscriptions: [ - { - ...eg.makeStream(), - color: '#ffffff', - in_home_view: false, - pin_to_top: false, - audible_notifications: false, - desktop_notifications: false, - email_address: 'stream@email.com', - is_old_stream: false, - push_notifications: true, - stream_weekly_traffic: 2, - }, - ], + subscriptions: [], theme: 'default', twentyFourHourTime: false, }); @@ -141,7 +128,7 @@ describe('constructHeaderActionButtons', () => { const subscriptions = deepFreeze([ { - ...baseBackgroundData.subscriptions[0], + ...eg.subscription, name: 'electron issues', in_home_view: false, }, @@ -168,7 +155,7 @@ describe('constructHeaderActionButtons', () => { const subscriptions = deepFreeze([ { - ...baseBackgroundData.subscriptions[0], + ...eg.subscription, name: 'electron issues', in_home_view: true, },