Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro-Melnyshyn committed Oct 15, 2024
2 parents 8e5edf4 + dcc6595 commit 21a0cdb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* [UIQM-704](https://issues.folio.org/browse/UIQM-704) Linked fields - combine split fields before sending for validation.
* [UIQM-708](https://issues.folio.org/browse/UIQM-708) Change 007 Microforms type to allow 4 characters in RRR/RR field.
* [UIQM-714](https://issues.folio.org/browse/UIQM-714) *BREAKING* Upgrade `inventory` to `14.0`.
* [UIQM-709](https://issues.folio.org/browse/UIQM-709) LCCN duplication: Update the bib request query to include only the non-suppressed record in the search results.
* [UIQM-701](https://issues.folio.org/browse/UIQM-701) Use new GA workflows.

## [8.0.1] (https://github.com/folio-org/ui-quick-marc/tree/v8.0.1) (2024-04-18)
Expand Down
4 changes: 4 additions & 0 deletions src/hooks/useValidation/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@ export const validateLccnDuplication = async ({
query: `(${lccnQuery})${idQuery}`,
};

if (marcType === MARC_TYPES.BIB) {
searchParams.query += ' not (staffSuppress=="true" and discoverySuppress=="true")';
}

const requests = {
[MARC_TYPES.BIB]: () => ky.get('search/instances', { searchParams }),
[MARC_TYPES.AUTHORITY]: () => ky.get('search/authorities', { searchParams }),
Expand Down
28 changes: 28 additions & 0 deletions src/hooks/useValidation/validators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,5 +781,33 @@ describe('validators', () => {
expect(rule.message).toHaveBeenCalled();
});
});

it('should call the bib record with the `staffSuppress` and `discoverySuppress` parameters', async () => {
const marcRecords = [{
tag: LEADER_TAG,
content: bibLeader,
}, {
tag: '010',
content: '$a test',
}];
const ky = {
get: jest.fn().mockResolvedValue({}),
};

await validators.validateLccnDuplication({
ky,
marcRecords,
marcType: MARC_TYPES.BIB,
action: QUICK_MARC_ACTIONS.EDIT,
duplicateLccnCheckingEnabled: true,
instanceId: 'instanceId-1',
}, rule);

expect(ky.get).toHaveBeenCalledWith('search/instances', {
searchParams: expect.objectContaining({
query: expect.stringContaining(' not (staffSuppress=="true" and discoverySuppress=="true")'),
}),
});
});
});
});

0 comments on commit 21a0cdb

Please sign in to comment.