Skip to content

Commit

Permalink
fix: add type prop to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kubabutkiewicz committed Feb 15, 2024
1 parent 312114e commit d993823
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/types/onyx/ReportAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {Receipt} from './Transaction';

type Message = {
/** The type of the action item fragment. Used to render a corresponding component */
type?: string;
type: string;

/** The text content of the fragment. */
text: string;
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/isReportMessageAttachmentTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ describe('isReportMessageAttachment', () => {
const message: Message = {
text: '[Attachment]',
html: '<img src="https://www.expensify.com/chat-attachments/1260926113061804740/w_66791ca35b3c34c2a0eda4d065d97c9907cadd61.jpg.1024.jpg" data-expensify-source="https://www.expensify.com/chat-attachments/1260926113061804740/w_66791ca35b3c34c2a0eda4d065d97c9907cadd61.jpg" data-name="rn_image_picker_lib_temp_636b71a8-18fd-41a1-9725-6587ffb207a7.jpg" data-expensify-width="4000" data-expensify-height="3000" />',
type: '',
};
expect(isReportMessageAttachment(message)).toBe(true);
});

it('returns false if a report action is not attachment', () => {
let message: Message = {text: '[Attachment]', html: '<em>[Attachment]</em>'};
let message: Message = {text: '[Attachment]', html: '<em>[Attachment]</em>', type: ''};
expect(isReportMessageAttachment(message)).toBe(false);

message = {text: '[Attachment]', html: '<a href="https://www.google.com" target="_blank" rel="noreferrer noopener">[Attachment]</a>'};
message = {text: '[Attachment]', html: '<a href="https://www.google.com" target="_blank" rel="noreferrer noopener">[Attachment]</a>', type: ''};
expect(isReportMessageAttachment(message)).toBe(false);

message = {text: '[Attachment]', html: '<a href="https://www.google.com/?data-expensify-source=" target="_blank" rel="noreferrer noopener">[Attachment]</a>'};
message = {text: '[Attachment]', html: '<a href="https://www.google.com/?data-expensify-source=" target="_blank" rel="noreferrer noopener">[Attachment]</a>', type: ''};
expect(isReportMessageAttachment(message)).toBe(false);
});
});

0 comments on commit d993823

Please sign in to comment.