diff --git a/src/QuickMarcEditor/QuickMarcCreateWrapper.js b/src/QuickMarcEditor/QuickMarcCreateWrapper.js index 318ec453..0dfc94bc 100644 --- a/src/QuickMarcEditor/QuickMarcCreateWrapper.js +++ b/src/QuickMarcEditor/QuickMarcCreateWrapper.js @@ -39,7 +39,7 @@ const propTypes = { location: ReactRouterPropTypes.location.isRequired, locations: PropTypes.object.isRequired, marcType: PropTypes.oneOf(Object.values(MARC_TYPES)).isRequired, - marcSpec: PropTypes.object.isRequired, + fixedFieldSpec: PropTypes.object.isRequired, mutator: PropTypes.object.isRequired, onClose: PropTypes.func.isRequired, }; @@ -53,7 +53,7 @@ const QuickMarcCreateWrapper = ({ history, location, marcType, - marcSpec, + fixedFieldSpec, locations, }) => { const showCallout = useShowCallout(); @@ -69,11 +69,11 @@ const QuickMarcCreateWrapper = ({ autopopulatePhysDescriptionField, autopopulateMaterialCharsField, marcRecord => autopopulateSubfieldSection(marcRecord, marcType), - marcRecord => cleanBytesFields(marcRecord, marcSpec), + marcRecord => cleanBytesFields(marcRecord, fixedFieldSpec), )(formValues); return formValuesForCreate; - }, [marcType, marcSpec]); + }, [marcType, fixedFieldSpec]); const validate = useCallback((formValues) => { const formValuesForValidation = prepareForSubmit(formValues); @@ -184,7 +184,7 @@ const QuickMarcCreateWrapper = ({ onSubmit={onSubmit} action={action} marcType={marcType} - marcSpec={marcSpec} + fixedFieldSpec={fixedFieldSpec} httpError={httpError} validate={validate} /> diff --git a/src/QuickMarcEditor/QuickMarcDeriveWrapper.js b/src/QuickMarcEditor/QuickMarcDeriveWrapper.js index 425af3eb..4bc6c5fb 100644 --- a/src/QuickMarcEditor/QuickMarcDeriveWrapper.js +++ b/src/QuickMarcEditor/QuickMarcDeriveWrapper.js @@ -36,7 +36,7 @@ const propTypes = { initialValues: PropTypes.object.isRequired, instance: PropTypes.object, marcType: PropTypes.oneOf(Object.values(MARC_TYPES)).isRequired, - marcSpec: PropTypes.object.isRequired, + fixedFieldSpec: PropTypes.object.isRequired, mutator: PropTypes.object.isRequired, onClose: PropTypes.func.isRequired, }; @@ -48,7 +48,7 @@ const QuickMarcDeriveWrapper = ({ initialValues, mutator, marcType, - marcSpec, + fixedFieldSpec, }) => { const showCallout = useShowCallout(); const { linkableBibFields, actualizeLinks, linkingRules } = useAuthorityLinking({ marcType, action }); @@ -64,11 +64,11 @@ const QuickMarcDeriveWrapper = ({ autopopulatePhysDescriptionField, autopopulateMaterialCharsField, marcRecord => autopopulateSubfieldSection(marcRecord, marcType), - marcRecord => cleanBytesFields(marcRecord, marcSpec), + marcRecord => cleanBytesFields(marcRecord, fixedFieldSpec), )(formValues); return formValuesForDerive; - }, [marcType, marcSpec]); + }, [marcType, fixedFieldSpec]); const validate = useCallback((formValues) => { const formValuesForValidation = prepareForSubmit(formValues); @@ -159,7 +159,7 @@ const QuickMarcDeriveWrapper = ({ onSubmit={onSubmit} action={action} marcType={marcType} - marcSpec={marcSpec} + fixedFieldSpec={fixedFieldSpec} httpError={httpError} confirmRemoveAuthorityLinking validate={validate} diff --git a/src/QuickMarcEditor/QuickMarcEditWrapper.js b/src/QuickMarcEditor/QuickMarcEditWrapper.js index 79a534eb..02384eef 100644 --- a/src/QuickMarcEditor/QuickMarcEditWrapper.js +++ b/src/QuickMarcEditor/QuickMarcEditWrapper.js @@ -50,7 +50,7 @@ const propTypes = { initialValues: PropTypes.object.isRequired, instance: PropTypes.object, marcType: PropTypes.oneOf(Object.values(MARC_TYPES)).isRequired, - marcSpec: PropTypes.object.isRequired, + fixedFieldSpec: PropTypes.object.isRequired, mutator: PropTypes.object.isRequired, onClose: PropTypes.func.isRequired, onCheckCentralTenantPerm: PropTypes.func, @@ -64,7 +64,7 @@ const QuickMarcEditWrapper = ({ initialValues, mutator, marcType, - marcSpec, + fixedFieldSpec, linksCount, locations, refreshPageData, @@ -142,7 +142,7 @@ const QuickMarcEditWrapper = ({ autopopulatePhysDescriptionField, autopopulateMaterialCharsField, marcRecord => autopopulateSubfieldSection(marcRecord, marcType), - marcRecord => cleanBytesFields(marcRecord, marcSpec), + marcRecord => cleanBytesFields(marcRecord, fixedFieldSpec), combineSplitFields, )(formValues); @@ -234,7 +234,7 @@ const QuickMarcEditWrapper = ({ initialValues, instance, marcType, - marcSpec, + fixedFieldSpec, mutator, linksCount, location, @@ -256,7 +256,7 @@ const QuickMarcEditWrapper = ({ onSubmit={onSubmit} action={action} marcType={marcType} - marcSpec={marcSpec} + fixedFieldSpec={fixedFieldSpec} locations={locations} httpError={httpError} externalRecordPath={externalRecordPath} diff --git a/src/QuickMarcEditor/QuickMarcEditor.js b/src/QuickMarcEditor/QuickMarcEditor.js index f167c7c2..e233acc6 100644 --- a/src/QuickMarcEditor/QuickMarcEditor.js +++ b/src/QuickMarcEditor/QuickMarcEditor.js @@ -91,7 +91,7 @@ const QuickMarcEditor = ({ getState, }, marcType, - marcSpec, + fixedFieldSpec, locations, httpError, externalRecordPath, @@ -476,7 +476,7 @@ const QuickMarcEditor = ({ type={type} subtype={subtype} marcType={marcType} - marcSpec={marcSpec} + fixedFieldSpec={fixedFieldSpec} instance={instance} linksCount={linksCount} isLoadingLinkSuggestions={isLoadingLinkSuggestions} @@ -553,7 +553,7 @@ QuickMarcEditor.propTypes = { reset: PropTypes.func.isRequired, }), marcType: PropTypes.oneOf(Object.values(MARC_TYPES)).isRequired, - marcSpec: PropTypes.object.isRequired, + fixedFieldSpec: PropTypes.object.isRequired, linksCount: PropTypes.number, locations: PropTypes.arrayOf(PropTypes.object).isRequired, httpError: PropTypes.shape({ diff --git a/src/QuickMarcEditor/QuickMarcEditorContainer.js b/src/QuickMarcEditor/QuickMarcEditorContainer.js index 2debb36b..ddd4927f 100644 --- a/src/QuickMarcEditor/QuickMarcEditorContainer.js +++ b/src/QuickMarcEditor/QuickMarcEditorContainer.js @@ -86,7 +86,7 @@ const QuickMarcEditorContainer = ({ const [locations, setLocations] = useState(); const [isLoading, setIsLoading] = useState(true); const [linksCount, setLinksCount] = useState(0); - const [marcSpec, setMarcSpec] = useState(); + const [fixedFieldSpec, setFixedFieldSpec] = useState(); const searchParams = new URLSearchParams(location.search); const { token, locale } = stripes.okapi; @@ -148,7 +148,7 @@ const QuickMarcEditorContainer = ({ ? fetchLinksCount([externalId]) : Promise.resolve(); - const marcSpecPromise = mutator.marcSpec.GET({ + const fixedFieldSpecPromise = mutator.fixedFieldSpec.GET({ path: `${MARC_SPEC_API}/${marcType}/008`, ...headers, }); @@ -159,7 +159,7 @@ const QuickMarcEditorContainer = ({ locationsPromise, linksCountPromise, linkingRulesPromise, - marcSpecPromise, + fixedFieldSpecPromise, ]) .then(([ instanceResponse, @@ -167,7 +167,7 @@ const QuickMarcEditorContainer = ({ locationsResponse, linksCountResponse, linkingRulesResponse, - marcSpecResponse, + fixedFieldSpecResponse, ]) => { if (marcType === MARC_TYPES.AUTHORITY) { setLinksCount(linksCountResponse.links[0].totalLinks); @@ -186,7 +186,7 @@ const QuickMarcEditorContainer = ({ if (action === QUICK_MARC_ACTIONS.CREATE) { dehydratedMarcRecord = createRecordDefaults[marcType](instanceResponse); } else { - dehydratedMarcRecord = dehydrateMarcRecordResponse(marcRecordResponse, marcType, marcSpecResponse); + dehydratedMarcRecord = dehydrateMarcRecordResponse(marcRecordResponse, marcType, fixedFieldSpecResponse); } const formattedMarcRecord = formatMarcRecordByQuickMarcAction(dehydratedMarcRecord, action, marcType); @@ -196,7 +196,7 @@ const QuickMarcEditorContainer = ({ setInstance(instanceResponse); setMarcRecord(marcRecordWithSplitFields); setLocations(locationsResponse); - setMarcSpec(marcSpecResponse); + setFixedFieldSpec(fixedFieldSpecResponse); setIsLoading(false); }) .catch(() => { @@ -241,7 +241,7 @@ const QuickMarcEditorContainer = ({ location={location} locations={locations} marcType={marcType} - marcSpec={marcSpec} + fixedFieldSpec={fixedFieldSpec} refreshPageData={loadData} externalRecordPath={externalRecordUrl} resources={resources} @@ -286,7 +286,7 @@ QuickMarcEditorContainer.manifest = Object.freeze({ path: LINKING_RULES_API, throwErrors: false, }, - marcSpec: { + fixedFieldSpec: { type: 'okapi', fetch: false, accumulate: true, diff --git a/src/QuickMarcEditor/QuickMarcEditorContainer.test.js b/src/QuickMarcEditor/QuickMarcEditorContainer.test.js index 99a7fb43..abf60c10 100644 --- a/src/QuickMarcEditor/QuickMarcEditorContainer.test.js +++ b/src/QuickMarcEditor/QuickMarcEditorContainer.test.js @@ -133,7 +133,7 @@ describe('Given Quick Marc Editor Container', () => { linkingRules: { GET: jest.fn().mockResolvedValue([]), }, - marcSpec: { + fixedFieldSpec: { GET: jest.fn(() => Promise.resolve()), }, }; diff --git a/src/QuickMarcEditor/QuickMarcEditorRows/FixedField/FixedFieldFactory.js b/src/QuickMarcEditor/QuickMarcEditorRows/FixedField/FixedFieldFactory.js index ef59ee3a..c747685f 100644 --- a/src/QuickMarcEditor/QuickMarcEditorRows/FixedField/FixedFieldFactory.js +++ b/src/QuickMarcEditor/QuickMarcEditorRows/FixedField/FixedFieldFactory.js @@ -31,47 +31,41 @@ export const FixedFieldFactory = { return FixedField; }, - getDocumentType(marcSpec, type, subtype) { - let idx = -1; - - if (!marcSpec?.spec) { + getFixedFieldType(fixedFieldSpec, type, subtype) { + if (!fixedFieldSpec?.spec) { return undefined; } - const checkTypeSubType = (orElement) => { - const hasTypePos = orElement.positions['6'] || false; - const hasSubTypePos = orElement.positions['7'] || false; - const typeOK = hasTypePos && orElement.positions['6'].includes(type); - const subTypeOK = hasSubTypePos ? hasSubTypePos && orElement.positions['7'].includes(subtype) : true; + const checkTypeSubType = (fieldIdentifier) => { + const hasTypePos = fieldIdentifier.positions['6'] || false; + const hasSubTypePos = fieldIdentifier.positions['7'] || false; + const typeOK = hasTypePos && fieldIdentifier.positions['6'].includes(type); + const subTypeOK = hasSubTypePos ? hasSubTypePos && fieldIdentifier.positions['7'].includes(subtype) : true; return (typeOK && subTypeOK); }; - marcSpec.spec.types.forEach((marcType, indexType) => { - marcType.identifiedBy.or.forEach(orElement => { - if (orElement.tag === LEADER_TAG) { - if (checkTypeSubType(orElement)) { - idx = indexType; - } - } + const fixedFieldType = fixedFieldSpec.spec.types.find((fixedFieldTypeFind) => { + return fixedFieldTypeFind.identifiedBy.or.some((fieldIdentifier) => { + return fieldIdentifier.tag === LEADER_TAG && checkTypeSubType(fieldIdentifier); }); }); - return idx !== -1 ? marcSpec.spec.types[idx] : undefined; + return fixedFieldType; }, - getConfigFixedField(marcSpec, type, subtype = '') { - const documentType = this.getDocumentType(marcSpec, type, subtype); + getConfigFixedField(fixedFieldSpec, type, subtype = '') { + const fixedFieldType = this.getFixedFieldType(fixedFieldSpec, type, subtype); const config = { fields: [], - type: documentType?.code || undefined, + type: fixedFieldType?.code || undefined, }; - if (!documentType) { + if (!fixedFieldType) { return config; } - config.fields = documentType.items.filter(x => !x.readOnly).map((item) => { + config.fields = fixedFieldType.items.filter(x => !x.readOnly).map((item) => { if (item.isArray) { return { name: item.code, @@ -103,9 +97,9 @@ export const FixedFieldFactory = { return config; }, - getFixedField(name, marcType, marcSpec, type, subtype) { + getFixedField(name, marcType, fixedFieldSpec, type, subtype) { const FixedField = this.getFixedFieldByType(marcType); - const configFixedField = this.getConfigFixedField(marcSpec, type, subtype); + const configFixedField = this.getConfigFixedField(fixedFieldSpec, type, subtype); return FixedField ? : null; }, diff --git a/src/QuickMarcEditor/QuickMarcEditorRows/FixedField/FixedFieldFactory.test.js b/src/QuickMarcEditor/QuickMarcEditorRows/FixedField/FixedFieldFactory.test.js index ec7e96da..2f14907c 100644 --- a/src/QuickMarcEditor/QuickMarcEditorRows/FixedField/FixedFieldFactory.test.js +++ b/src/QuickMarcEditor/QuickMarcEditorRows/FixedField/FixedFieldFactory.test.js @@ -6,9 +6,9 @@ import BibliographicFixedField from './BibliographicFixedField'; import HoldingsFixedField from './HoldingsFixedField'; import AuthorityFixedField from './AuthorityFixedField'; import { MARC_TYPES } from '../../../common/constants'; -import marcSpecificationBib from '../../../../test/mocks/marcSpecificationBib'; -import marcSpecificationAuth from '../../../../test/mocks/marcSpecificationAuth'; -import marcSpecificationHold from '../../../../test/mocks/marcSpecificationHold'; +import fixedFieldSpecBib from '../../../../test/mocks/fixedFieldSpecBib'; +import fixedFieldSpecAuth from '../../../../test/mocks/fixedFieldSpecAuth'; +import fixedFieldSpecHold from '../../../../test/mocks/fixedFieldSpecHold'; describe('FixedFieldFactory', () => { it('should create correct marc type fixed field', () => { @@ -25,97 +25,97 @@ describe('FixedFieldFactory', () => { ).toBe(HoldingsFixedField.displayName); }); - it('should create correct document type', () => { + it('should create correct fixed field type', () => { expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 'a', 'm').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 'a', 'm').props.config.type, ).toBe('books'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 'a', 'a').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 'a', 'a').props.config.type, ).toBe('books'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 'a', 'd').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 'a', 'd').props.config.type, ).toBe('books'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 'a', 'x').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 'a', 'x').props.config.type, ).toBe(undefined); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 't').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 't').props.config.type, ).toBe('books'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 'c').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 'c').props.config.type, ).toBe('scores'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 'i').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 'i').props.config.type, ).toBe('sound_recordings'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 'a', 'b').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 'a', 'b').props.config.type, ).toBe('continuing_resources'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 'a', 'i').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 'a', 'i').props.config.type, ).toBe('continuing_resources'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 'a', 's').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 'a', 's').props.config.type, ).toBe('continuing_resources'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 's').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 's').props.config.type, ).toBe('continuing_resources'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 'm').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 'm').props.config.type, ).toBe('computer_files'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 'g').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 'g').props.config.type, ).toBe('visual_materials'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 'e').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 'e').props.config.type, ).toBe('maps'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 'f').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 'f').props.config.type, ).toBe('maps'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 'p').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 'p').props.config.type, ).toBe('mixed_materials'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.AUTHORITY, marcSpecificationAuth, 'z').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.AUTHORITY, fixedFieldSpecAuth, 'z').props.config.type, ).toBe('unknown'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.AUTHORITY, marcSpecificationAuth, 'z').type.displayName, + FixedFieldFactory.getFixedField('records', MARC_TYPES.AUTHORITY, fixedFieldSpecAuth, 'z').type.displayName, ).toBe(AuthorityFixedField.displayName); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.HOLDINGS, marcSpecificationHold, 'u').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.HOLDINGS, fixedFieldSpecHold, 'u').props.config.type, ).toBe('unknown'); expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.HOLDINGS, marcSpecificationHold, 'u').type.displayName, + FixedFieldFactory.getFixedField('records', MARC_TYPES.HOLDINGS, fixedFieldSpecHold, 'u').type.displayName, ).toBe(HoldingsFixedField.displayName); }); it('should return undefined type when there is no matched field', () => { expect( - FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, marcSpecificationBib, 'l').props.config.type, + FixedFieldFactory.getFixedField('records', MARC_TYPES.BIB, fixedFieldSpecBib, 'l').props.config.type, ).toBe(undefined); }); it('should return null when marc types is wrong', () => { expect( - FixedFieldFactory.getFixedField('records', 'instance', marcSpecificationBib, 'l'), + FixedFieldFactory.getFixedField('records', 'instance', fixedFieldSpecBib, 'l'), ).toBe(null); }); }); diff --git a/src/QuickMarcEditor/QuickMarcEditorRows/QuickMarcEditorRows.js b/src/QuickMarcEditor/QuickMarcEditorRows/QuickMarcEditorRows.js index b827057b..c5b0cd04 100644 --- a/src/QuickMarcEditor/QuickMarcEditorRows/QuickMarcEditorRows.js +++ b/src/QuickMarcEditor/QuickMarcEditorRows/QuickMarcEditorRows.js @@ -79,7 +79,7 @@ const QuickMarcEditorRows = ({ updateRecord, }, marcType, - marcSpec, + fixedFieldSpec, instance, linksCount, isLoadingLinkSuggestions, @@ -293,7 +293,7 @@ const QuickMarcEditorRows = ({ isRequestToCentralTenantFromMember, onCheckCentralTenantPerm, ); - const canBeLinkedAuto = isRecordForAutoLinking(recordRow, autoLinkableBibFields) || false; + const canBeLinkedAuto = isRecordForAutoLinking(recordRow, autoLinkableBibFields); const canViewAuthorityRecord = stripes.hasPerm('ui-marc-authorities.authority-record.view') && recordRow._isLinked; @@ -470,7 +470,7 @@ const QuickMarcEditorRows = ({ { isFixedField && ( FixedFieldFactory.getFixedField( - `${name}.content`, marcType, marcSpec, type, subtype, + `${name}.content`, marcType, fixedFieldSpec, type, subtype, ) ) } @@ -595,7 +595,7 @@ QuickMarcEditorRows.propTypes = { updateRecord: PropTypes.func.isRequired, }), marcType: PropTypes.oneOf(Object.values(MARC_TYPES)).isRequired, - marcSpec: PropTypes.object.isRequired, + fixedFieldSpec: PropTypes.object.isRequired, onCheckCentralTenantPerm: PropTypes.func, }; diff --git a/src/QuickMarcEditor/QuickMarcEditorRows/QuickMarcEditorRows.test.js b/src/QuickMarcEditor/QuickMarcEditorRows/QuickMarcEditorRows.test.js index aa5796d5..67a199a9 100644 --- a/src/QuickMarcEditor/QuickMarcEditorRows/QuickMarcEditorRows.test.js +++ b/src/QuickMarcEditor/QuickMarcEditorRows/QuickMarcEditorRows.test.js @@ -57,10 +57,6 @@ jest.mock('../../queries', () => ({ sourceFiles: [], isLoading: false, }), - useMarcSpecifications: jest.fn().mockReturnValue({ - fixedFieldRules: {}, - isLoading: false, - }), })); const initValues = [ diff --git a/src/QuickMarcEditor/utils.test.js b/src/QuickMarcEditor/utils.test.js index fc7eb0d8..049fdf08 100644 --- a/src/QuickMarcEditor/utils.test.js +++ b/src/QuickMarcEditor/utils.test.js @@ -13,9 +13,9 @@ import { MARC_TYPES } from '../common/constants'; import { RECORD_STATUS_NEW } from './QuickMarcRecordInfo/constants'; import * as utils from './utils'; -import marcSpecificationBib from '../../test/mocks/marcSpecificationBib'; -import marcSpecificationAuth from '../../test/mocks/marcSpecificationAuth'; -import marcSpecificationHold from '../../test/mocks/marcSpecificationHold'; +import fixedFieldSpecBib from '../../test/mocks/fixedFieldSpecBib'; +import fixedFieldSpecAuth from '../../test/mocks/fixedFieldSpecAuth'; +import fixedFieldSpecHold from '../../test/mocks/fixedFieldSpecHold'; jest.mock('uuid', () => { return { @@ -84,7 +84,7 @@ describe('QuickMarcEditor utils', () => { ], }; - const dehydratedMarcRecord = utils.dehydrateMarcRecordResponse(marcRecord, MARC_TYPES.BIB, marcSpecificationBib); + const dehydratedMarcRecord = utils.dehydrateMarcRecordResponse(marcRecord, MARC_TYPES.BIB, fixedFieldSpecBib); const field006 = dehydratedMarcRecord.records[2]; const field007 = dehydratedMarcRecord.records[3]; const field008 = dehydratedMarcRecord.records[4]; @@ -1595,7 +1595,7 @@ describe('QuickMarcEditor utils', () => { }, }; - expect(utils.fillEmptyFixedFieldValues(marcType, marcSpecificationBib, type, blvl, field)).toMatchObject({ + expect(utils.fillEmptyFixedFieldValues(marcType, fixedFieldSpecBib, type, blvl, field)).toMatchObject({ Srce: '\\', Audn: '\\', Lang: 'eng', @@ -1629,7 +1629,7 @@ describe('QuickMarcEditor utils', () => { }, }; - expect(utils.fillEmptyFixedFieldValues(marcType, marcSpecificationAuth, type, blvl, field)).toMatchObject({ + expect(utils.fillEmptyFixedFieldValues(marcType, fixedFieldSpecAuth, type, blvl, field)).toMatchObject({ 'Geo Subd': '\\', 'Kind rec': '\\', 'SH Sys': '\\', @@ -1667,7 +1667,7 @@ describe('QuickMarcEditor utils', () => { }, }; - expect(utils.fillEmptyFixedFieldValues(marcType, marcSpecificationHold, type, blvl, field)).toMatchObject({ + expect(utils.fillEmptyFixedFieldValues(marcType, fixedFieldSpecHold, type, blvl, field)).toMatchObject({ AcqStatus: '\\', AcqMethod: '\\', AcqEndDate: '\\\\\\\\', @@ -2302,7 +2302,7 @@ describe('QuickMarcEditor utils', () => { }, }; - expect(utils.cleanBytesFields(record, marcSpecificationBib)).toEqual(expectedRecord); + expect(utils.cleanBytesFields(record, fixedFieldSpecBib)).toEqual(expectedRecord); }); }); diff --git a/test/mocks/marcSpecificationAuth.js b/test/mocks/fixedFieldSpecAuth.js similarity index 98% rename from test/mocks/marcSpecificationAuth.js rename to test/mocks/fixedFieldSpecAuth.js index ff577443..f8276a40 100644 --- a/test/mocks/marcSpecificationAuth.js +++ b/test/mocks/fixedFieldSpecAuth.js @@ -1,4 +1,4 @@ -const marcSpecificationAuth = { +const fixedFieldSpecAuth = { tag: '008', spec: { types: [ @@ -228,4 +228,4 @@ const marcSpecificationAuth = { }, }; -export default marcSpecificationAuth; +export default fixedFieldSpecAuth; diff --git a/test/mocks/marcSpecificationBib.js b/test/mocks/fixedFieldSpecBib.js similarity index 99% rename from test/mocks/marcSpecificationBib.js rename to test/mocks/fixedFieldSpecBib.js index 95c0a8a0..5ef0f399 100644 --- a/test/mocks/marcSpecificationBib.js +++ b/test/mocks/fixedFieldSpecBib.js @@ -1,4 +1,4 @@ -const marcSpecificationBib = { +const fixedFieldSpecBib = { tag: '008', spec: { types: [ @@ -458,4 +458,4 @@ const marcSpecificationBib = { }, }; -export default marcSpecificationBib; +export default fixedFieldSpecBib; diff --git a/test/mocks/marcSpecificationHold.js b/test/mocks/fixedFieldSpecHold.js similarity index 97% rename from test/mocks/marcSpecificationHold.js rename to test/mocks/fixedFieldSpecHold.js index 8e81f10e..5d8be858 100644 --- a/test/mocks/marcSpecificationHold.js +++ b/test/mocks/fixedFieldSpecHold.js @@ -1,4 +1,4 @@ -const marcSpecificationHold = { +const fixedFieldSpecHold = { tag: '008', spec: { types: [ @@ -138,4 +138,4 @@ const marcSpecificationHold = { }, }; -export default marcSpecificationHold; +export default fixedFieldSpecHold;