Skip to content

Commit

Permalink
ref: move isReportMessageAttachmentTest to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
kubabutkiewicz committed Feb 7, 2024
1 parent a1b1595 commit 312114e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 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
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import type {Message} from '@src/types/onyx/ReportAction';
import isReportMessageAttachment from '../../src/libs/isReportMessageAttachment';

describe('isReportMessageAttachment', () => {
it('returns true if a report action is attachment', () => {
const message = {
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" />',
};
expect(isReportMessageAttachment(message)).toBe(true);
});

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

message = {text: '[Attachment]', html: '<a href="https://www.google.com" target="_blank" rel="noreferrer noopener">[Attachment]</a>'};
Expand Down

0 comments on commit 312114e

Please sign in to comment.