diff --git a/src/components/messenger/feed/index.test.tsx b/src/components/messenger/feed/index.test.tsx index baca59925..06440a112 100644 --- a/src/components/messenger/feed/index.test.tsx +++ b/src/components/messenger/feed/index.test.tsx @@ -6,7 +6,13 @@ import { StoreBuilder, stubConversation } from '../../../store/test/store'; describe(MessengerFeed, () => { const subject = (props: Partial) => { const allProps: Properties = { + user: { data: null }, + channel: null, + activeConversationId: 'channel-id', isSocialChannel: false, + isJoiningConversation: false, + sendPost: jest.fn(), + fetchPosts: jest.fn(), ...props, }; @@ -14,13 +20,34 @@ describe(MessengerFeed, () => { }; it('renders Messenger Feed when isSocialChannel is true', () => { - const wrapper = subject({ isSocialChannel: true }); - expect(wrapper); + const channel = stubConversation({ name: 'convo-1', hasLoadedMessages: true, messages: [] }); + + const wrapper = subject({ channel: channel as any, isSocialChannel: true }); + expect(wrapper).toHaveElement('CreatePost'); }); it('does not render Messenger Feed when isSocialChannel is false', () => { - const wrapper = subject({ isSocialChannel: false }); - expect(wrapper).not.toHaveText('Messenger Feed'); + const channel = stubConversation({ name: 'convo-1', hasLoadedMessages: true, messages: [] }); + + const wrapper = subject({ channel: channel as any, isSocialChannel: false }); + + expect(wrapper).not.toHaveElement('CreatePost'); + }); + + it('does not render Messenger Feed when isJoiningConversation is true', () => { + const channel = stubConversation({ name: 'convo-1', hasLoadedMessages: true, messages: [] }); + + const wrapper = subject({ channel: channel as any, isSocialChannel: true, isJoiningConversation: true }); + + expect(wrapper).not.toHaveElement('CreatePost'); + }); + + it('does not render Messenger Feed when no active conversation id', () => { + const channel = stubConversation({ name: 'convo-1', hasLoadedMessages: true, messages: [] }); + + const wrapper = subject({ channel: channel as any, isSocialChannel: true, activeConversationId: null }); + + expect(wrapper).not.toHaveElement('CreatePost'); }); describe('mapState', () => {