Skip to content

Commit

Permalink
MODLD-646: Update response schema of authority assignment check API
Browse files Browse the repository at this point in the history
  • Loading branch information
pkjacob committed Jan 28, 2025
1 parent a8517d2 commit 95c1265
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/common/hooks/useComplexLookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ export const useComplexLookup = ({
}
}

const isValid = await validateMarcRecord(marcData);
const { validAssignment } = await validateMarcRecord(marcData);

if (isValid) {
if (validAssignment) {
assignMarcRecord({ id, title, srsId, linkedFieldValue });
clearFailedEntryIds();
reset();
Expand Down
4 changes: 2 additions & 2 deletions src/test/__tests__/common/hooks/useComplexLookup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ describe('useComplexLookup', () => {
(getLinkedField as jest.Mock).mockReturnValue(mockLinkedField);
(updateLinkedFieldValue as jest.Mock).mockReturnValue({ uuid: 'newLinkedFieldId' });
(getUpdatedSelectedEntries as jest.Mock).mockReturnValue(['newId']);
mockMakeRequest.mockResolvedValue(true);
mockMakeRequest.mockResolvedValue({ validAssignment: true });

result = getRenderedHook()?.result;

Expand All @@ -184,7 +184,7 @@ describe('useComplexLookup', () => {
});

test('updates state correctly and does not call "setSelectedEntries"', async () => {
mockMakeRequest.mockResolvedValue(true);
mockMakeRequest.mockResolvedValue({ validAssignment: true });

result = getRenderedHook({
...mockEntry,
Expand Down

0 comments on commit 95c1265

Please sign in to comment.