fix: TypeError: Cannot read properties of null (reading 'user_id') (#9884)

This commit is contained in:
Sivin Varghese
2024-08-07 14:42:01 +05:30
committed by GitHub
parent 56e93d152d
commit b03a839809
3 changed files with 31 additions and 12 deletions

View File

@@ -178,5 +178,17 @@ describe('Helper functions', () => {
const logActionKey = generateLogActionKey(auditLogItem);
expect(logActionKey).toEqual('AUDIT_LOGS.ACCOUNT_USER.EDIT.OTHER');
});
it('should generate correct action key when updating a deleted user', () => {
const auditLogItem = {
auditable_type: 'AccountUser',
action: 'update',
user_id: 1,
auditable: null,
};
const logActionKey = generateLogActionKey(auditLogItem);
expect(logActionKey).toEqual('AUDIT_LOGS.ACCOUNT_USER.EDIT.DELETED');
});
});
});