Skip to content

Commit

Permalink
UIIN-2012: After using the Chrome "go back" button, following the lin…
Browse files Browse the repository at this point in the history
…k "Holdings Created" from Data import to Inventory causes an error. (#1656)
  • Loading branch information
mariia-aloshyna authored and mkuklis committed Jul 20, 2022
1 parent 096dc8c commit cff2832
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ViewHoldingsRecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ class ViewHoldingsRecord extends React.Component {
};

isAwaitingResource = () => {
const { referenceTables } = this.props;
const {
holdingsRecords,
instances1,
Expand All @@ -425,7 +426,7 @@ class ViewHoldingsRecord extends React.Component {
return true;
}

return false;
return isEmpty(referenceTables);
};

getEntity = () => this.getMostRecentHolding();
Expand Down
10 changes: 10 additions & 0 deletions src/ViewHoldingsRecord.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import { renderWithIntl, translationsProperties } from '../test/jest/helpers';
import ViewHoldingsRecord from './ViewHoldingsRecord';

jest.mock('./withLocation', () => jest.fn(c => c));
jest.mock('@folio/stripes/components', () => ({
...jest.requireActual('@folio/stripes/components'),
LoadingView: () => 'LoadingView',
}));

const defaultProps = {
id: 'id',
Expand Down Expand Up @@ -67,6 +71,12 @@ describe('ViewHoldingsRecord actions', () => {
defaultProps.history.push.mockClear();
});

it('should render Loading when awaiting resource', () => {
const { getByText } = renderViewHoldingsRecord({ referenceTables: {} })

expect(getByText('LoadingView')).toBeDefined();
});

it('should close view holding page', async () => {
renderViewHoldingsRecord();

Expand Down

0 comments on commit cff2832

Please sign in to comment.