Skip to content

Commit

Permalink
UIIN-3195: Update translation
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksandrHladchenko1 committed Jan 23, 2025
1 parent 5733bfb commit 5d2cfce
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/views/ItemView.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,39 @@ describe('ItemView', () => {
describe('when an error was occured', () => {
it('should show an error message', async () => {
useHoldingMutation.mockClear().mockReturnValue({ mutateHolding: mockMutate });
useUpdateOwnership.mockClear().mockReturnValue({ updateOwnership: jest.fn().mockRejectedValue() });
useUpdateOwnership.mockClear().mockReturnValue({
updateOwnership: jest.fn().mockRejectedValue({
response: {
status: 400,
}
})
});
checkIfUserInCentralTenant.mockClear().mockReturnValue(false);

renderWithIntl(<ItemViewSetup />, translationsProperties);

const updateOwnershipBtn = screen.getByText('Update ownership');
fireEvent.click(updateOwnershipBtn);

act(() => UpdateItemOwnershipModal.mock.calls[0][0].handleSubmit('university', { id: 'locationId' }, 'holdingId'));

const confirmationModal = screen.getByText('Update ownership of items');
fireEvent.click(within(confirmationModal).getByText('confirm'));

await waitFor(() => expect(screen.queryByText('Item ownership could not be updated because the record contains local-specific reference data.')).toBeDefined());
});
});

describe('when error was occured', () => {
it('should show an error message', async () => {
useHoldingMutation.mockClear().mockReturnValue({ mutateHolding: mockMutate });
useUpdateOwnership.mockClear().mockReturnValue({
updateOwnership: jest.fn().mockRejectedValue({
response: {
status: 500,
},
})
});
checkIfUserInCentralTenant.mockClear().mockReturnValue(false);

renderWithIntl(<ItemViewSetup />, translationsProperties);
Expand Down

0 comments on commit 5d2cfce

Please sign in to comment.