Skip to content

Commit

Permalink
Merge branch 'master' into UIDATIMP-1503
Browse files Browse the repository at this point in the history
  • Loading branch information
mariia-aloshyna authored Sep 22, 2023
2 parents 1d3bf7e + 80d8194 commit 9500362
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* Extend schema for profile relations manipulations (UIDATIMP-1471)
* Change validation messages which were represented in code format (UIDATIMP-1473)
* *BREAKING* bump `react` to `v18`, and dev-deps accordingly (UIDATIMP-1485)
* Match profile: update options for Instance "Incoming records" (UIDATIMP-1501)
* Match profile: update options for Item "Incoming records" (UIDATIMP-1503)
* Match profile: update options for MARC Authority "Incoming records" (UIDATIMP-1505)
* Update Node.js to v18 in GitHub Actions (UIDATIMP-1507)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ IncomingRecordMenu.propTypes = {
onToggle: PropTypes.func.isRequired,
keyHandler: PropTypes.func.isRequired,
dataAttributes: PropTypes.object,
existingRecordType: PropTypes.string,
};

IncomingRecordMenu.defaultProps = { dataAttributes: null };
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ import { MATCH_INCOMING_RECORD_TYPES } from '../../../utils';

const onClick = jest.fn();

const renderIncomingRecordMenu = ({ open }) => {
const renderIncomingRecordMenu = props => {
const component = (
<IncomingRecordMenu
open={open}
onClick={onClick}
onToggle={noop}
keyHandler={noop}
Expand All @@ -44,18 +43,58 @@ describe('IncomingRecordMenu component', () => {
const { getByText } = renderIncomingRecordMenu({ open: false });

expect(getByText('MARC Bibliographic')).not.toBeVisible();
expect(getByText('MARC Authority')).not.toBeVisible();
expect(getByText('Static value (submatch only)')).not.toBeVisible();
});
});

describe('when dropdown menu is open', () => {
it('record types should be visible', () => {
const { getByText } = renderIncomingRecordMenu({ open: true });
describe('when exisiting record type is "INSTANCE"', () => {
it('should render "MARC Bibliographic" and "Static value" options', () => {
const { getByText } = renderIncomingRecordMenu({ open: true, existingRecordType: 'INSTANCE' });

expect(getByText('MARC Bibliographic')).toBeVisible();
expect(getByText('Static value (submatch only)')).toBeVisible();
});
});

describe('when exisiting record type is "HOLDINGS"', () => {
it('should render "MARC Bibliographic", "MARC Authority" and "Static value" options', () => {
const { getByText } = renderIncomingRecordMenu({ open: true, existingRecordType: 'HOLDINGS' });

expect(getByText('MARC Bibliographic')).toBeVisible();
expect(getByText('MARC Authority')).toBeVisible();
expect(getByText('Static value (submatch only)')).toBeVisible();
});
});

describe('when exisiting record type is "ITEM"', () => {
it('should render "MARC Bibliographic", "MARC Authority" and "Static value" options', () => {
const { getByText } = renderIncomingRecordMenu({ open: true, existingRecordType: 'ITEM' });

expect(getByText('MARC Bibliographic')).toBeVisible();
expect(getByText('MARC Authority')).toBeVisible();
expect(getByText('Static value (submatch only)')).toBeVisible();
});
});

describe('when exisiting record type is "MARC_BIBLIOGRAPHIC"', () => {
it('should render "MARC Bibliographic", "MARC Authority" and "Static value" options', () => {
const { getByText } = renderIncomingRecordMenu({ open: true, existingRecordType: 'MARC_BIBLIOGRAPHIC' });

expect(getByText('MARC Bibliographic')).toBeVisible();
expect(getByText('MARC Authority')).toBeVisible();
expect(getByText('Static value (submatch only)')).toBeVisible();
});
});

describe('when exisiting record type is "MARC_AUTHORITY"', () => {
it('should render "MARC Bibliographic", "MARC Authority" and "Static value" options', () => {
const { getByText } = renderIncomingRecordMenu({ open: true, existingRecordType: 'MARC_AUTHORITY' });

expect(getByText('MARC Bibliographic')).toBeVisible();
expect(getByText('MARC Authority')).toBeVisible();
expect(getByText('Static value (submatch only)')).toBeVisible();
expect(getByText('MARC Bibliographic')).toBeVisible();
expect(getByText('MARC Authority')).toBeVisible();
expect(getByText('Static value (submatch only)')).toBeVisible();
});
});
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
import classNames from 'classnames';

import {
Button,
Icon,
} from '@folio/stripes/components';
import { AppIcon } from '@folio/stripes/core';

import classNames from 'classnames';

import css from '../RecordTypesSelect.css';

export const IncomingRecordTrigger = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ describe('RecordItem component', () => {
fireEvent.click(getByText('Holdings'));

expect(getByText('MARC Bibliographic')).toBeVisible();
expect(getByText('MARC Authority')).toBeVisible();
expect(getByText('Static value (submatch only)')).toBeVisible();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const renderMappingInvoiceDetails = () => {
};

describe('MappingInvoiceDetails view component', () => {
it('should be rendered with no axe errors', async () => {
it.skip('should be rendered with no axe errors', async () => {
const { container } = renderMappingInvoiceDetails();

await runAxeTest({ rootNode: container });
Expand Down
19 changes: 19 additions & 0 deletions src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -868,3 +868,22 @@ export const STATUS_CODES = {
CONFLICT: 409,
INTERNAL_SERVER_ERROR: 500,
};

export const ALLOWED_INCOMING_RECORD_TYPES = {
[FOLIO_RECORD_TYPES.INSTANCE.type]: omit(MATCH_INCOMING_RECORD_TYPES, [
MATCH_INCOMING_RECORD_TYPES.MARC_HOLDINGS.type,
MATCH_INCOMING_RECORD_TYPES.MARC_AUTHORITY.type,
]),
[FOLIO_RECORD_TYPES.HOLDINGS.type]: omit(MATCH_INCOMING_RECORD_TYPES, [
MATCH_INCOMING_RECORD_TYPES.MARC_HOLDINGS.type,
]),
[FOLIO_RECORD_TYPES.ITEM.type]: omit(MATCH_INCOMING_RECORD_TYPES, [
MATCH_INCOMING_RECORD_TYPES.MARC_HOLDINGS.type,
]),
[FOLIO_RECORD_TYPES.MARC_BIBLIOGRAPHIC.type]: omit(MATCH_INCOMING_RECORD_TYPES, [
MATCH_INCOMING_RECORD_TYPES.MARC_HOLDINGS.type,
]),
[FOLIO_RECORD_TYPES.MARC_AUTHORITY.type]: omit(MATCH_INCOMING_RECORD_TYPES, [
MATCH_INCOMING_RECORD_TYPES.MARC_HOLDINGS.type,
]),
};

0 comments on commit 9500362

Please sign in to comment.