-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36024 from kubabutkiewicz/ts-migration/isReportMe…
…ssageAttachmentTest [No QA] [TS migration] Migrate 'isReportMessageAttachmentTest.js' test to TypeScript
- Loading branch information
Showing
1 changed file
with
6 additions
and
4 deletions.
There are no files selected for viewing
10 changes: 6 additions & 4 deletions
10
tests/unit/isReportMessageAttachmentTest.js → tests/unit/isReportMessageAttachmentTest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
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" />', | ||
type: '', | ||
}; | ||
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>', 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); | ||
}); | ||
}); |