Skip to content

Commit d061194

Browse files
committed
Refactor tests to pass with new parameter
1 parent bd5a3e2 commit d061194

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

tests/unit/ReportUtilsTest.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3096,9 +3096,8 @@ describe('ReportUtils', () => {
30963096
await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, report);
30973097

30983098
// When it's checked if the description can be edited
3099-
// const {result: isReportArchived} = renderHook(() => useReportIsArchived(report?.reportID));
3100-
// const result = canEditReportDescription(report, isReportArchived.current);
3101-
const result = canEditReportDescription(report, policy);
3099+
const {result: isReportArchived} = renderHook(() => useReportIsArchived(report?.reportID));
3100+
const result = canEditReportDescription(report, policy, isReportArchived.current);
31023101

31033102
// Then it can be edited
31043103
expect(result).toBeTruthy();
@@ -3107,17 +3106,16 @@ describe('ReportUtils', () => {
31073106
it('should return false for an archived policy room', async () => {
31083107
// Given an archived policy room
31093108
const report: Report = {
3110-
...createRandomReport(40001),
3109+
...createRandomReport(40002),
31113110
chatType: CONST.REPORT.CHAT_TYPE.POLICY_ROOM,
31123111
participants: buildParticipantsFromAccountIDs([currentUserAccountID, 1]),
31133112
};
31143113
await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, report);
31153114
await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report.reportID}`, {private_isArchived: DateUtils.getDBTime()});
31163115

31173116
// When it's checked if the description can be edited
3118-
// const {result: isReportArchived} = renderHook(() => useReportIsArchived(report?.reportID));
3119-
// const result = canEditReportDescription(report, isReportArchived.current);
3120-
const result = canEditReportDescription(report, policy);
3117+
const {result: isReportArchived} = renderHook(() => useReportIsArchived(report?.reportID));
3118+
const result = canEditReportDescription(report, policy, isReportArchived.current);
31213119

31223120
// Then it cannot be edited
31233121
expect(result).toBeFalsy();

0 commit comments

Comments
 (0)