diff --git a/CHANGELOG.md b/CHANGELOG.md index d7106c25..dcc1f8e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/settings/index.js b/src/settings/index.js index 51800ac1..323ed55f 100644 --- a/src/settings/index.js +++ b/src/settings/index.js @@ -51,13 +51,6 @@ class Organization extends React.Component { component: Plugins, perm: 'ui-tenant-settings.settings.plugins.view', }, - { - route: 'ssosettings', - label: , - component: SSOSettings, - perm: 'ui-tenant-settings.settings.sso.view', - iface: 'login-saml' - }, { route: 'reading-room', label: , @@ -65,6 +58,13 @@ class Organization extends React.Component { perm: 'ui-tenant-settings.settings.reading-room-access.view', iface: 'reading-room' }, + { + route: 'ssosettings', + label: , + component: SSOSettings, + perm: 'ui-tenant-settings.settings.sso.view', + iface: 'login-saml' + }, { route: 'servicePoints', label: , diff --git a/src/settings/index.test.js b/src/settings/index.test.js index d9778acd..d77e36c7 100644 --- a/src/settings/index.test.js +++ b/src/settings/index.test.js @@ -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(); expect(queryByText('ui-tenant-settings.settings.ssoSettings.label')).toBeTruthy(); }); @@ -48,4 +50,23 @@ describe('Organization', () => { const { queryByText } = renderWithRouter(); 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(); + 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(); + 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(); + expect(queryByText('ui-tenant-settings.settings.reading-room-access.label')).toBeNull(); + }); }); diff --git a/test/jest/__new_mocks__/stripesCore.mock.js b/test/jest/__new_mocks__/stripesCore.mock.js index 2b1d3773..9fb3bd2b 100644 --- a/test/jest/__new_mocks__/stripesCore.mock.js +++ b/test/jest/__new_mocks__/stripesCore.mock.js @@ -10,7 +10,7 @@ const buildStripes = (otherProperties = {}) => ({ }, currency: 'USD', hasInterface: () => true, - hasPerm: jest.fn(() => true), + hasPerm: () => true, locale: 'en-US', logger: { log: () => { },