regular
', @@ -35,14 +34,15 @@ const foreignMsg = { text: 'udSNfyk7Z-0MRn17WUQwY', type: 'regular', updated_at: '2024-05-28T15:13:20.900Z', - user: null, + user: otherUser, }; const ownMessage = generateMessage({ user }); const errorMsg = { ...foreignMsg, type: 'error', user }; const sendingMsg = { ...foreignMsg, status: 'sending', user }; -const deliveredMsg = { ...foreignMsg, user }; -const readByOthers = [{ id: 'other-user' }]; +const sentMsg = { ...foreignMsg, user }; +const deliveredTo = [otherUser, user]; +const readByOthers = [otherUser, user]; const t = jest.fn((s) => s); const defaultMsgCtx = { @@ -67,7 +67,12 @@ describe('MessageStatus', () => { const client = await getTestClientWithUser(user); const { container } = renderComponent({ chatCtx: { client }, - messageCtx: { isMyMessage: () => false, message: foreignMsg }, + messageCtx: { + deliveredTo, + isMyMessage: () => false, + message: foreignMsg, + readBy: readByOthers, + }, }); expect(container).toBeEmptyDOMElement(); }); @@ -75,58 +80,65 @@ describe('MessageStatus', () => { const client = await getTestClientWithUser(user); const { container } = renderComponent({ chatCtx: { client }, - messageCtx: { message: errorMsg }, + messageCtx: { + deliveredTo, + message: errorMsg, + readBy: readByOthers, + }, }); expect(container).toBeEmptyDOMElement(); }); - it('renders default sending UI for the last message', async () => { + it('renders default sending UI', async () => { const client = await getTestClientWithUser(user); renderComponent({ chatCtx: { client }, - messageCtx: { lastReceivedId: sendingMsg.id, message: sendingMsg }, + messageCtx: { message: sendingMsg }, }); expect(screen.getByTestId(MESSAGE_STATUS_SENDING_TEST_ID)).toMatchSnapshot(); }); - it('renders custom sending UI for the last message', async () => { + it('renders custom sending UI', async () => { const text = 'CustomMessageSendingStatus'; const MessageSendingStatus = () =>