Skip to content

Commit

Permalink
Merge pull request #695 from codeforpdx/693/update-outbox-recipient-text
Browse files Browse the repository at this point in the history
update outbox recipient text
  • Loading branch information
oddwili authored Nov 20, 2024
2 parents 7c38bda + db63717 commit 6b37f9a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/components/Messages/MessagePreview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ const MessagePreview = ({ message, folderType }) => {
return 2;
};

const isInbox = folderType === 'Inbox';

const messageInfo = [
{
title: 'Sender: ',
text: message?.sender,
title: isInbox ? 'Sender: ' : 'Recipient: ',
text: isInbox ? message?.sender : message?.recipient,
xs_value: isSmallScreen ? 12 : renderMediumGridLeft()
},
{
Expand Down
24 changes: 21 additions & 3 deletions test/components/Messages/MessagePreview.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ import createMatchMedia from '../../helpers/createMatchMedia';

const queryClient = new QueryClient();

const mockMessageInfo = { sender: 'test', title: 'test title', uploadDate: new Date('1-1-2000') };
const MockMessagePreview = () => (
const mockMessageInfo = {
sender: 'test',
recipient: 'testrecipient',
title: 'test title',
uploadDate: new Date('1-1-2000')
};
const MockMessagePreview = ({ folderType = 'Inbox' }) => (
<QueryClientProvider client={queryClient}>
<MessagePreview message={mockMessageInfo} />
<MessagePreview message={mockMessageInfo} folderType={folderType} />
</QueryClientProvider>
);

Expand Down Expand Up @@ -54,3 +59,16 @@ describe('Grid sizes', () => {
expect(dateCell.classList.contains('MuiGrid-grid-xs-12')).toBe(true);
});
});

describe('Outbox shows Recipient instead of Sender', () => {
afterEach(() => {
cleanup();
});

it('renders Recipient text', () => {
const { getByText } = render(<MockMessagePreview folderType="Outbox" />);
const recipientCell = getByText('Recipient:').parentElement;

expect(recipientCell.classList.contains('MuiGrid-grid-xs-5')).toBe(true);
});
});

0 comments on commit 6b37f9a

Please sign in to comment.