diff --git a/src/components/EditSections/EditUserInfo/EditUserInfo.test.js b/src/components/EditSections/EditUserInfo/EditUserInfo.test.js index 1bfed3477..3d7f7bf7f 100644 --- a/src/components/EditSections/EditUserInfo/EditUserInfo.test.js +++ b/src/components/EditSections/EditUserInfo/EditUserInfo.test.js @@ -11,6 +11,9 @@ import EditUserInfo from './EditUserInfo'; import { isConsortiumEnabled } from '../../util'; import { USER_TYPES } from '../../../constants'; +jest.mock('../../../hooks', () => ({ + useProfilePicture: jest.fn(), +})); jest.mock('@folio/stripes/components', () => ({ ...jest.requireActual('@folio/stripes/components'), Modal: jest.fn(({ children, label, footer, ...rest }) => { @@ -34,6 +37,8 @@ jest.mock('../../util', () => ({ isConsortiumEnabled: jest.fn(() => true), })); +jest.mock('./components/ProfilePicture', () => jest.fn(() => 'Profile Picture')); + const onSubmit = jest.fn(); const arrayMutators = { @@ -122,7 +127,8 @@ const props = { PUT: jest.fn(), cancel: jest.fn(), reset: jest.fn() - } + }, + areProfilePicturesEnabled: true, }; describe('Render Edit User Information component', () => { @@ -183,4 +189,16 @@ describe('Render Edit User Information component', () => { expect(screen.getByRole('textbox', { name: /lastName/ })).toBeDisabled(); expect(screen.getByRole('textbox', { name: /firstName/ })).toBeDisabled(); }); + + it('should display profile picture', () => { + renderEditUserInfo(props); + expect(screen.getByText('Profile Picture')).toBeInTheDocument(); + }); + + describe('when profilePicture configuration is not enabled', () => { + it('should not render profile picture', () => { + renderEditUserInfo({ ...props, areProfilePicturesEnabled: false }); + expect(screen.queryByText('Profile Picture')).not.toBeInTheDocument(); + }); + }); }); diff --git a/src/views/UserDetail/UserDetail.test.js b/src/views/UserDetail/UserDetail.test.js index 5a5d46c24..92de85592 100644 --- a/src/views/UserDetail/UserDetail.test.js +++ b/src/views/UserDetail/UserDetail.test.js @@ -198,6 +198,7 @@ describe('UserDetail', () => { beforeEach(() => { stripes = useStripes(); + stripes.hasPerm = () => true; mutator.hasManualPatronBlocks.GET.mockImplementation(() => Promise.resolve([])); mutator.hasAutomatedPatronBlocks.GET.mockImplementation(() => Promise.resolve([])); });