Skip to content

Commit

Permalink
move getReportIDFromLink tests to ReportUtilsTest
Browse files Browse the repository at this point in the history
  • Loading branch information
marcochavezf committed Mar 9, 2023
1 parent d62dfdb commit 58f06fd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
15 changes: 0 additions & 15 deletions tests/actions/ReportTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -666,19 +666,4 @@ describe('actions/Report', () => {
expect(resultAction.message[0].reactions).toHaveLength(0);
});
});

it('should get the correct reportID from a deep link', () => {
expect(ReportUtils.getReportIDFromLink('new-expensify://r/75431276')).toBe('75431276');
expect(ReportUtils.getReportIDFromLink('https://www.expensify.cash/r/75431276')).toBe('75431276');
expect(ReportUtils.getReportIDFromLink('https://staging.new.expensify.com/r/75431276')).toBe('75431276');
expect(ReportUtils.getReportIDFromLink('http://localhost/r/75431276')).toBe('75431276');
expect(ReportUtils.getReportIDFromLink('http://localhost:8080/r/75431276')).toBe('75431276');
expect(ReportUtils.getReportIDFromLink('https://staging.expensify.cash/r/75431276')).toBe('75431276');
expect(ReportUtils.getReportIDFromLink('https://new.expensify.com/r/75431276')).toBe('75431276');
});

it('shouldn\'t get the correct reportID from a deep link', () => {
expect(ReportUtils.getReportIDFromLink('new-expensify-not-valid://r/75431276')).toBe('');
expect(ReportUtils.getReportIDFromLink('new-expensify://settings')).toBe('');
});
});
17 changes: 17 additions & 0 deletions tests/unit/ReportUtilsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,4 +391,21 @@ describe('ReportUtils', () => {
expect(iouOptions.includes(CONST.IOU.IOU_TYPE.SEND)).toBe(true);
});
});

describe('getReportIDFromLink', () => {
it('should get the correct reportID from a deep link', () => {
expect(ReportUtils.getReportIDFromLink('new-expensify://r/75431276')).toBe('75431276');
expect(ReportUtils.getReportIDFromLink('https://www.expensify.cash/r/75431276')).toBe('75431276');
expect(ReportUtils.getReportIDFromLink('https://staging.new.expensify.com/r/75431276')).toBe('75431276');
expect(ReportUtils.getReportIDFromLink('http://localhost/r/75431276')).toBe('75431276');
expect(ReportUtils.getReportIDFromLink('http://localhost:8080/r/75431276')).toBe('75431276');
expect(ReportUtils.getReportIDFromLink('https://staging.expensify.cash/r/75431276')).toBe('75431276');
expect(ReportUtils.getReportIDFromLink('https://new.expensify.com/r/75431276')).toBe('75431276');
});

it('shouldn\'t get the correct reportID from a deep link', () => {
expect(ReportUtils.getReportIDFromLink('new-expensify-not-valid://r/75431276')).toBe('');
expect(ReportUtils.getReportIDFromLink('new-expensify://settings')).toBe('');
});
});
});

0 comments on commit 58f06fd

Please sign in to comment.