diff --git a/src/message/__tests__/messageActionSheet-test.js b/src/message/__tests__/messageActionSheet-test.js index 54bfceae569..5372a61585f 100644 --- a/src/message/__tests__/messageActionSheet-test.js +++ b/src/message/__tests__/messageActionSheet-test.js @@ -23,40 +23,31 @@ describe('constructActionButtons', () => { test('show star message option if message is not starred', () => { const message = eg.streamMessage(); const flags = { ...baseBackgroundData.flags, starred: {} }; - const buttons = constructMessageActionButtons({ backgroundData: { ...baseBackgroundData, flags }, message, narrow, }); - expect(buttons).toContain('starMessage'); }); test('show unstar message option if message is starred', () => { const message = eg.streamMessage(); const flags = { ...baseBackgroundData.flags, starred: { [message.id]: true } }; - const buttons = constructMessageActionButtons({ backgroundData: { ...baseBackgroundData, flags }, message, narrow, }); - expect(buttons).toContain('unstarMessage'); }); test('show reactions option if message is has at least one reaction', () => { - const message = eg.streamMessage({ - reactions: [eg.unicodeEmojiReaction], - }); - const buttons = constructMessageActionButtons({ backgroundData: baseBackgroundData, - message, + message: eg.streamMessage({ reactions: [eg.unicodeEmojiReaction] }), narrow, }); - expect(buttons).toContain('showReactions'); }); }); @@ -66,86 +57,54 @@ describe('constructHeaderActionButtons', () => { test('show Unmute topic option if topic is muted', () => { const mute = deepFreeze([['electron issues', 'issue #556']]); - - const backgroundData = deepFreeze({ ...baseBackgroundData, mute }); - const message = eg.streamMessage({ display_recipient: 'electron issues', subject: 'issue #556', }); - const buttons = constructHeaderActionButtons({ - backgroundData, + backgroundData: { ...baseBackgroundData, mute }, message, narrow, }); - expect(buttons).toContain('unmuteTopic'); }); test('show mute topic option if topic is not muted', () => { - const mute = deepFreeze([]); - - const backgroundData = deepFreeze({ ...baseBackgroundData, mute }); - const buttons = constructHeaderActionButtons({ - backgroundData, + backgroundData: { ...baseBackgroundData, mute: [] }, message: eg.streamMessage(), narrow, }); - expect(buttons).toContain('muteTopic'); }); test('show Unmute stream option if stream is not in home view', () => { const subscriptions = [{ ...eg.subscription, in_home_view: false }]; - - const backgroundData = deepFreeze({ - ...baseBackgroundData, - subscriptions, - }); - const buttons = constructHeaderActionButtons({ - backgroundData, + backgroundData: { ...baseBackgroundData, subscriptions }, message: eg.streamMessage(), narrow, }); - expect(buttons).toContain('unmuteStream'); }); test('show mute stream option if stream is in home view', () => { const subscriptions = [{ ...eg.subscription, in_home_view: true }]; - - const backgroundData = deepFreeze({ - ...baseBackgroundData, - subscriptions, - }); - const buttons = constructHeaderActionButtons({ - backgroundData, + backgroundData: { ...baseBackgroundData, subscriptions }, message: eg.streamMessage(), narrow, }); - expect(buttons).toContain('muteStream'); }); test('show delete topic option if current user is an admin', () => { - const backgroundData = deepFreeze({ - ...baseBackgroundData, - ownUser: { - ...baseBackgroundData.ownUser, - is_admin: true, - }, - }); - + const ownUser = { ...eg.selfUser, is_admin: true }; const buttons = constructHeaderActionButtons({ - backgroundData, + backgroundData: { ...baseBackgroundData, ownUser }, message: eg.streamMessage(), narrow, }); - expect(buttons).toContain('deleteTopic'); }); @@ -155,7 +114,6 @@ describe('constructHeaderActionButtons', () => { message: eg.streamMessage(), narrow, }); - expect(buttons).not.toContain('deleteTopic'); }); });