Skip to content

Commit

Permalink
FIXES MORE TESTS
Browse files Browse the repository at this point in the history
  • Loading branch information
ishpaul777 committed Aug 18, 2024
1 parent 8504a1d commit 4d34462
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions tests/actions/IOUTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('actions/IOU', () => {
iouReportID = iouReport?.reportID;
transactionThread = transactionThreadReport;

expect(iouReport?.participants).toBe({
expect(iouReport?.participants).toEqual({
[RORY_ACCOUNT_ID]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN},
[CARLOS_ACCOUNT_ID]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN},
});
Expand Down Expand Up @@ -296,7 +296,7 @@ describe('actions/IOU', () => {
const iouReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.IOU);
iouReportID = iouReport?.reportID;

expect(iouReport?.participants).toBe({
expect(iouReport?.participants).toEqual({
[RORY_ACCOUNT_ID]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN},
[CARLOS_ACCOUNT_ID]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN},
});
Expand Down Expand Up @@ -2631,7 +2631,7 @@ describe('actions/IOU', () => {
// Given a transaction thread
thread = ReportUtils.buildTransactionThread(createIOUAction, iouReport);

expect(thread.participants).toBe({[RORY_ACCOUNT_ID]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, role: CONST.REPORT.ROLE.ADMIN}});
expect(thread.participants).toEqual({[RORY_ACCOUNT_ID]: {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, role: CONST.REPORT.ROLE.ADMIN}});

const participantAccountIDs = Object.keys(thread.participants ?? {}).map(Number);
const userLogins = PersonalDetailsUtils.getLoginsByAccountIDs(participantAccountIDs);
Expand Down
8 changes: 6 additions & 2 deletions tests/actions/PolicyTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import waitForBatchedUpdates from '../utils/waitForBatchedUpdates';

const ESH_EMAIL = '[email protected]';
const ESH_ACCOUNT_ID = 1;
const ESH_PARTICIPANT: Participant = {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.DAILY, role: 'admin'};
const ESH_PARTICIPANT_ANNOUNCE_ROOM: Participant = {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.DAILY, role: 'admin'};
const ESH_PARTICIPANT_ADMINS_ROOM: Participant = {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, role: 'admin'};
const ESH_PARTICIPANT_EXPENSE_CHAT = {notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, role: 'admin'}
const WORKSPACE_NAME = "Esh's Workspace";

OnyxUpdateManager();
Expand Down Expand Up @@ -78,17 +80,19 @@ describe('actions/Policy', () => {
expect(workspaceReports.length).toBe(3);
workspaceReports.forEach((report) => {
expect(report?.pendingFields?.addWorkspaceRoom).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);
expect(report?.participants).toEqual({[ESH_ACCOUNT_ID]: ESH_PARTICIPANT});
switch (report?.chatType) {
case CONST.REPORT.CHAT_TYPE.POLICY_ADMINS: {
expect(report?.participants).toEqual({ [ESH_ACCOUNT_ID]: ESH_PARTICIPANT_ADMINS_ROOM });
adminReportID = report.reportID;
break;
}
case CONST.REPORT.CHAT_TYPE.POLICY_ANNOUNCE: {
expect(report?.participants).toEqual({ [ESH_ACCOUNT_ID]: ESH_PARTICIPANT_ANNOUNCE_ROOM });
announceReportID = report.reportID;
break;
}
case CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT: {
expect(report?.participants).toEqual({ [ESH_ACCOUNT_ID]: ESH_PARTICIPANT_EXPENSE_CHAT });
expenseReportID = report.reportID;
break;
}
Expand Down

0 comments on commit 4d34462

Please sign in to comment.