Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UITEN-301 - Display Reading room access in alphabetical order on settings page. #412

Merged
merged 2 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* [UITEN-283] (https://issues.folio.org/browse/UITEN-283) Reading Room Access (settings): Delete reading room.
* [UITEN-290] (https://issues.folio.org/browse/UITEN-290) Make dependency on mod-reading-rooms optional.
* [UITEN-298] (https://issues.folio.org/browse/UITEN-298) Update translation ids for reading room.
* [UITEN-301] (https://issues.folio.org/browse/UITEN-301) Display Reading room access in alphabetical order on settings page.

## [8.1.0](https://github.com/folio-org/ui-tenant-settings/tree/v8.1.0)(2024-03-19)
[Full Changelog](https://github.com/folio-org/ui-tenant-settings/compare/v8.0.0...v8.1.0)
Expand Down
14 changes: 7 additions & 7 deletions src/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@ class Organization extends React.Component {
component: Plugins,
perm: 'ui-tenant-settings.settings.plugins.view',
},
{
route: 'ssosettings',
label: <FormattedMessage id="ui-tenant-settings.settings.ssoSettings.label" />,
component: SSOSettings,
perm: 'ui-tenant-settings.settings.sso.view',
iface: 'login-saml'
},
{
route: 'reading-room',
label: <FormattedMessage id="ui-tenant-settings.settings.reading-room-access.label" />,
component: ReadingRoomAccess,
perm: 'ui-tenant-settings.settings.reading-room-access.view',
iface: 'reading-room'
},
{
route: 'ssosettings',
label: <FormattedMessage id="ui-tenant-settings.settings.ssoSettings.label" />,
component: SSOSettings,
perm: 'ui-tenant-settings.settings.sso.view',
iface: 'login-saml'
},
{
route: 'servicePoints',
label: <FormattedMessage id="ui-tenant-settings.settings.servicePoints.label" />,
Expand Down
21 changes: 21 additions & 0 deletions src/settings/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ describe('Organization', () => {
};
stripes.setIsAuthenticated = jest.fn();
stripes.hasInterface = jest.fn().mockReturnValue(false);
stripes.hasPerm = jest.fn().mockReturnValue(false);
});

it('should render SSO Settings when login-saml interface is present', () => {
stripes.hasInterface = jest.fn().mockReturnValue(true);
stripes.hasPerm = jest.fn().mockReturnValue(true);
const { queryByText } = renderWithRouter(<Organization {...props} />);
expect(queryByText('ui-tenant-settings.settings.ssoSettings.label')).toBeTruthy();
});
Expand All @@ -48,4 +50,23 @@ describe('Organization', () => {
const { queryByText } = renderWithRouter(<Organization {...props} />);
expect(queryByText('ui-tenant-settings.settings.ssoSettings.label')).toBeNull();
});

it('should render Reading room access when associated permission and interface are present', () => {
stripes.hasInterface = jest.fn().mockReturnValue(true);
stripes.hasPerm = jest.fn().mockReturnValue(true);
const { queryByText } = renderWithRouter(<Organization {...props} />);
expect(queryByText('ui-tenant-settings.settings.reading-room-access.label')).toBeTruthy();
});

it('should not render Reading room access when ui-tenant-settings.settings.reading-room-access.view permission is not present', () => {
stripes.hasInterface = jest.fn().mockReturnValue(true);
const { queryByText } = renderWithRouter(<Organization {...props} />);
expect(queryByText('ui-tenant-settings.settings.reading-room-access.label')).toBeNull();
});

it('should not render Reading room access when reading-room interface is not present', () => {
stripes.hasPerm = jest.fn().mockReturnValue(true);
const { queryByText } = renderWithRouter(<Organization {...props} />);
expect(queryByText('ui-tenant-settings.settings.reading-room-access.label')).toBeNull();
});
});
2 changes: 1 addition & 1 deletion test/jest/__new_mocks__/stripesCore.mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const buildStripes = (otherProperties = {}) => ({
},
currency: 'USD',
hasInterface: () => true,
hasPerm: jest.fn(() => true),
hasPerm: () => true,
locale: 'en-US',
logger: {
log: () => { },
Expand Down
Loading