From 2210b9c5ecad1df729f1851445425c75e08d775d Mon Sep 17 00:00:00 2001 From: Alisher Musurmonov Date: Mon, 23 Oct 2023 15:25:10 +0500 Subject: [PATCH] tests: add test coverage --- .../BankingInformationSettings/constants.js | 4 ---- src/Settings/SettingsPage.test.js | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) delete mode 100644 src/Settings/BankingInformationSettings/constants.js diff --git a/src/Settings/BankingInformationSettings/constants.js b/src/Settings/BankingInformationSettings/constants.js deleted file mode 100644 index f4707bf5..00000000 --- a/src/Settings/BankingInformationSettings/constants.js +++ /dev/null @@ -1,4 +0,0 @@ -export const typeStatus = [ - { value: 'Active' }, - { value: 'Inactive' }, -]; diff --git a/src/Settings/SettingsPage.test.js b/src/Settings/SettingsPage.test.js index c42a9fc1..d4b2e8a0 100644 --- a/src/Settings/SettingsPage.test.js +++ b/src/Settings/SettingsPage.test.js @@ -9,6 +9,10 @@ import { useBankingInformation } from './hooks'; jest.mock('@folio/stripes/core'); jest.mock('@folio/stripes/smart-components'); +jest.mock('@folio/stripes/components', () => ({ + ...jest.requireActual('@folio/stripes/components'), + Loading: () =>
Loading
, +})); jest.mock('./hooks', () => ({ useBankingInformation: jest.fn(() => ({ isLoading: false, @@ -57,4 +61,15 @@ describe('SettingsPage', () => { expect(screen.getByText('ui-organizations.settings.bankingAccountTypes')).toBeInTheDocument(); }); + + it('should display loading on fetching useBankingInformation', async () => { + useBankingInformation.mockReturnValue({ + isLoading: true, + enabled: false, + }); + + renderSettingsPage(); + + expect(screen.getByText('Loading')).toBeInTheDocument(); + }); });