Skip to content

Commit 581db07

Browse files
committed
add test
1 parent 000de5c commit 581db07

1 file changed

Lines changed: 92 additions & 0 deletions

File tree

tests/unit/OptionsListUtilsTest.ts

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,98 @@ describe('OptionsListUtils', () => {
801801
// Then the result should include the admin room
802802
expect(adminRoomOption).toBeDefined();
803803
});
804+
805+
it('should include brickRoadIndicator if showRBR is true', () => {
806+
const reportID = '1455140530846319';
807+
const workspaceChat: SearchOption<Report> = {
808+
item: {
809+
chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT,
810+
currency: 'USD',
811+
errorFields: {},
812+
lastActionType: 'CREATED',
813+
lastReadTime: '2025-03-21 07:25:46.279',
814+
lastVisibleActionCreated: '2024-12-15 21:13:24.317',
815+
lastVisibleActionLastModified: '2024-12-15 21:13:24.317',
816+
ownerAccountID: 0,
817+
permissions: ['read', 'write'],
818+
participants: {1: {notificationPreference: 'always'}},
819+
policyID: '52A5ABD88FBBD18F',
820+
policyName: "A's Workspace",
821+
reportID,
822+
reportName: "A's Workspace chat",
823+
type: 'chat',
824+
writeCapability: 'all',
825+
},
826+
text: "A's Workspace chat",
827+
alternateText: "A's Workspace",
828+
allReportErrors: {},
829+
subtitle: "A's Workspace",
830+
participantsList: [],
831+
reportID,
832+
keyForList: '1455140530846319',
833+
isDefaultRoom: true,
834+
isChatRoom: true,
835+
policyID: '52A5ABD88FBBD18F',
836+
lastMessageText: '',
837+
lastVisibleActionCreated: '2024-12-15 21:13:24.317',
838+
notificationPreference: 'hidden',
839+
brickRoadIndicator: CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR,
840+
};
841+
const results = getValidOptions(
842+
{reports: [workspaceChat], personalDetails: []},
843+
{
844+
includeMultipleParticipantReports: true,
845+
showRBR: true,
846+
},
847+
);
848+
expect(results.recentReports.at(0)?.brickRoadIndicator).toBe(CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR);
849+
});
850+
851+
it('should not include brickRoadIndicator if showRBR is false', () => {
852+
const reportID = '1455140530846319';
853+
const workspaceChat: SearchOption<Report> = {
854+
item: {
855+
chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT,
856+
currency: 'USD',
857+
errorFields: {},
858+
lastActionType: 'CREATED',
859+
lastReadTime: '2025-03-21 07:25:46.279',
860+
lastVisibleActionCreated: '2024-12-15 21:13:24.317',
861+
lastVisibleActionLastModified: '2024-12-15 21:13:24.317',
862+
ownerAccountID: 0,
863+
permissions: ['read', 'write'],
864+
participants: {1: {notificationPreference: 'always'}},
865+
policyID: '52A5ABD88FBBD18F',
866+
policyName: "A's Workspace",
867+
reportID,
868+
reportName: "A's Workspace chat",
869+
type: 'chat',
870+
writeCapability: 'all',
871+
},
872+
text: "A's Workspace chat",
873+
alternateText: "A's Workspace",
874+
allReportErrors: {},
875+
subtitle: "A's Workspace",
876+
participantsList: [],
877+
reportID,
878+
keyForList: '1455140530846319',
879+
isDefaultRoom: true,
880+
isChatRoom: true,
881+
policyID: '52A5ABD88FBBD18F',
882+
lastMessageText: '',
883+
lastVisibleActionCreated: '2024-12-15 21:13:24.317',
884+
notificationPreference: 'hidden',
885+
brickRoadIndicator: CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR,
886+
};
887+
const results = getValidOptions(
888+
{reports: [workspaceChat], personalDetails: []},
889+
{
890+
includeMultipleParticipantReports: true,
891+
showRBR: false,
892+
},
893+
);
894+
expect(results.recentReports.at(0)?.brickRoadIndicator).toBe(null);
895+
});
804896
});
805897

806898
describe('getValidOptions() for chat room', () => {

0 commit comments

Comments
 (0)