Skip to content

Commit

Permalink
remove hasOutstandingIOU from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rezkiy37 committed Dec 11, 2023
1 parent f8a8381 commit ad9d3c2
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 32 deletions.
17 changes: 0 additions & 17 deletions tests/actions/IOUTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ describe('actions/IOU', () => {
// They should be linked together
expect(chatReport.participantAccountIDs).toEqual([CARLOS_ACCOUNT_ID]);
expect(chatReport.iouReportID).toBe(iouReport.reportID);
expect(chatReport.hasOutstandingIOU).toBe(true);

resolve();
},
Expand Down Expand Up @@ -206,7 +205,6 @@ describe('actions/IOU', () => {
let chatReport = {
reportID: 1234,
type: CONST.REPORT.TYPE.CHAT,
hasOutstandingIOU: false,
participantAccountIDs: [CARLOS_ACCOUNT_ID],
};
const createdAction = {
Expand Down Expand Up @@ -249,7 +247,6 @@ describe('actions/IOU', () => {

// They should be linked together
expect(chatReport.iouReportID).toBe(iouReportID);
expect(chatReport.hasOutstandingIOU).toBe(true);

resolve();
},
Expand Down Expand Up @@ -370,7 +367,6 @@ describe('actions/IOU', () => {
let chatReport = {
reportID: chatReportID,
type: CONST.REPORT.TYPE.CHAT,
hasOutstandingIOU: true,
iouReportID,
participantAccountIDs: [CARLOS_ACCOUNT_ID],
};
Expand Down Expand Up @@ -581,7 +577,6 @@ describe('actions/IOU', () => {
// They should be linked together
expect(chatReport.participantAccountIDs).toEqual([CARLOS_ACCOUNT_ID]);
expect(chatReport.iouReportID).toBe(iouReport.reportID);
expect(chatReport.hasOutstandingIOU).toBe(true);

resolve();
},
Expand Down Expand Up @@ -815,7 +810,6 @@ describe('actions/IOU', () => {
let carlosChatReport = {
reportID: NumberUtils.rand64(),
type: CONST.REPORT.TYPE.CHAT,
hasOutstandingIOU: false,
participantAccountIDs: [CARLOS_ACCOUNT_ID],
};
const carlosCreatedAction = {
Expand All @@ -827,7 +821,6 @@ describe('actions/IOU', () => {
let julesChatReport = {
reportID: NumberUtils.rand64(),
type: CONST.REPORT.TYPE.CHAT,
hasOutstandingIOU: true,
iouReportID: julesIOUReportID,
participantAccountIDs: [JULES_ACCOUNT_ID],
};
Expand Down Expand Up @@ -985,16 +978,13 @@ describe('actions/IOU', () => {
expect(groupChat.pendingFields).toStrictEqual({createChat: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD});

// The 1:1 chat reports and the IOU reports should be linked together
expect(carlosChatReport.hasOutstandingIOU).toBe(true);
expect(carlosChatReport.iouReportID).toBe(carlosIOUReport.reportID);
expect(carlosIOUReport.chatReportID).toBe(carlosChatReport.reportID);
expect(carlosIOUReport.notificationPreference).toBe(CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN);

expect(julesChatReport.hasOutstandingIOU).toBe(true);
expect(julesChatReport.iouReportID).toBe(julesIOUReport.reportID);
expect(julesIOUReport.chatReportID).toBe(julesChatReport.reportID);

expect(vitChatReport.hasOutstandingIOU).toBe(true);
expect(vitChatReport.iouReportID).toBe(vitIOUReport.reportID);
expect(vitIOUReport.chatReportID).toBe(vitChatReport.reportID);
expect(carlosIOUReport.notificationPreference).toBe(CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN);
Expand Down Expand Up @@ -1233,7 +1223,6 @@ describe('actions/IOU', () => {
expect(chatReport).toBeTruthy();
expect(chatReport).toHaveProperty('reportID');
expect(chatReport).toHaveProperty('iouReportID');
expect(chatReport.hasOutstandingIOU).toBe(true);

iouReport = _.find(allReports, (report) => report.type === CONST.REPORT.TYPE.IOU);
expect(iouReport).toBeTruthy();
Expand Down Expand Up @@ -1313,7 +1302,6 @@ describe('actions/IOU', () => {
chatReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.CHAT);
iouReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.IOU);

expect(chatReport.hasOutstandingIOU).toBe(false);
expect(chatReport.iouReportID).toBeFalsy();

// expect(iouReport.status).toBe(CONST.REPORT.STATUS.REIMBURSED);
Expand Down Expand Up @@ -1364,7 +1352,6 @@ describe('actions/IOU', () => {
chatReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.CHAT);
iouReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.IOU);

expect(chatReport.hasOutstandingIOU).toBe(false);
expect(chatReport.iouReportID).toBeFalsy();

// expect(iouReport.status).toBe(CONST.REPORT.STATUS.REIMBURSED);
Expand Down Expand Up @@ -1925,7 +1912,6 @@ describe('actions/IOU', () => {
expect(chatReport).toBeTruthy();
expect(chatReport).toHaveProperty('reportID');
expect(chatReport).toHaveProperty('iouReportID');
expect(chatReport.hasOutstandingIOU).toBe(true);

// Then one of them should be an IOU report with relevant properties
iouReport = _.find(allReports, (report) => report.type === CONST.REPORT.TYPE.IOU);
Expand Down Expand Up @@ -2492,7 +2478,6 @@ describe('actions/IOU', () => {
expect(iouReport).toBeTruthy();
expect(iouReport).toHaveProperty('reportID');
expect(iouReport).toHaveProperty('chatReportID');
expect(iouReport.hasOutstandingIOU).toBeTruthy();
expect(iouReport.total).toBe(30000);

const ioupreview = ReportActionsUtils.getReportPreviewAction(chatReport.reportID, iouReport.reportID);
Expand All @@ -2510,7 +2495,6 @@ describe('actions/IOU', () => {
expect(iouReport).toBeTruthy();
expect(iouReport).toHaveProperty('reportID');
expect(iouReport).toHaveProperty('chatReportID');
expect(iouReport.hasOutstandingIOU).toBeTruthy();
expect(iouReport.total).toBe(20000);

// When we resume fetch
Expand All @@ -2520,7 +2504,6 @@ describe('actions/IOU', () => {
expect(iouReport).toBeTruthy();
expect(iouReport).toHaveProperty('reportID');
expect(iouReport).toHaveProperty('chatReportID');
expect(iouReport.hasOutstandingIOU).toBeTruthy();
expect(iouReport.total).toBe(20000);
});

Expand Down
1 change: 0 additions & 1 deletion tests/unit/OptionsListUtilsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ describe('OptionsListUtils', () => {
participantAccountIDs: [8],
reportName: 'Mister Sinister',
iouReportID: 100,
hasOutstandingIOU: true,
type: CONST.REPORT.TYPE.CHAT,
},

Expand Down
6 changes: 0 additions & 6 deletions tests/unit/ReportUtilsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ describe('ReportUtils', () => {
const report = {
...LHNTestUtils.getFakeReport(),
ownerAccountID: undefined,
hasOutstandingIOU: true,
};
expect(ReportUtils.requiresAttentionFromCurrentUser(report)).toBe(false);
});
Expand All @@ -266,15 +265,13 @@ describe('ReportUtils', () => {
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}1`, {
reportID: '1',
ownerAccountID: 99,
hasOutstandingIOU: true,
}).then(() => {
expect(ReportUtils.requiresAttentionFromCurrentUser(report)).toBe(false);
});
});
it('returns false when the report has no outstanding IOU but is waiting for a bank account and the logged user is the report owner', () => {
const report = {
...LHNTestUtils.getFakeReport(),
hasOutstandingIOU: false,
ownerAccountID: currentUserAccountID,
isWaitingOnBankAccount: true,
};
Expand All @@ -283,7 +280,6 @@ describe('ReportUtils', () => {
it('returns false when the report has outstanding IOU and is not waiting for a bank account and the logged user is the report owner', () => {
const report = {
...LHNTestUtils.getFakeReport(),
hasOutstandingIOU: true,
ownerAccountID: currentUserAccountID,
isWaitingOnBankAccount: false,
};
Expand All @@ -292,7 +288,6 @@ describe('ReportUtils', () => {
it('returns false when the report has no oustanding IOU but is waiting for a bank account and the logged user is not the report owner', () => {
const report = {
...LHNTestUtils.getFakeReport(),
hasOutstandingIOU: false,
ownerAccountID: 97,
isWaitingOnBankAccount: true,
};
Expand All @@ -319,7 +314,6 @@ describe('ReportUtils', () => {
const report = {
...LHNTestUtils.getFakeReport(),
ownerAccountID: 99,
hasOutstandingIOU: true,
hasOutstandingChildRequest: true,
isWaitingOnBankAccount: false,
};
Expand Down
4 changes: 0 additions & 4 deletions tests/unit/SidebarFilterTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,6 @@ describe('Sidebar', () => {
// 4. isUnread
// 5. isPinned
// 6. hasDraft
// There is one setting not represented here, which is hasOutstandingIOU. In order to test that setting, there must be
// additional reports in Onyx, so it's being left out for now. It's identical to the logic for hasDraft and isPinned though.

// Given these combinations of booleans which result in the report being filtered out (not shown).
const booleansWhichRemovesActiveReport = [
Expand Down Expand Up @@ -620,8 +618,6 @@ describe('Sidebar', () => {
// 4. isUnread
// 5. isPinned
// 6. hasDraft
// There is one setting not represented here, which is hasOutstandingIOU. In order to test that setting, there must be
// additional reports in Onyx, so it's being left out for now. It's identical to the logic for hasDraft and isPinned though.

// Given these combinations of booleans which result in the report being filtered out (not shown).
const booleansWhichRemovesActiveReport = [
Expand Down
1 change: 0 additions & 1 deletion tests/unit/SidebarOrderTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,6 @@ describe('Sidebar', () => {
};
const report3 = {
...LHNTestUtils.getFakeReport([5, 6]),
hasOutstandingIOU: false,

// This has to be added after the IOU report is generated
iouReportID: null,
Expand Down
3 changes: 0 additions & 3 deletions tests/utils/LHNTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,6 @@ function getFakeReportAction(actor = 'email1@test.com', millisecondsInThePast =
}

/**
* There is one setting not represented here, which is hasOutstandingIOU. In order to test that setting, there must be
* additional reports in Onyx, so it's being left out for now.
*
* @param {boolean} isArchived
* @param {boolean} isUserCreatedPolicyRoom
* @param {boolean} hasAddWorkspaceError
Expand Down

0 comments on commit ad9d3c2

Please sign in to comment.