From 000ee15569dcac8a84a826dd476cc87ea4093e7b Mon Sep 17 00:00:00 2001 From: Ankit Gade Date: Wed, 7 Aug 2024 18:25:12 +0530 Subject: [PATCH 1/8] Move files in dashboard directory. --- assets/js/components/DashboardMainApp.js | 2 +- .../ReaderRevenueManagerSetupCTABanner.js | 22 +++++++++---------- ...derRevenueManagerSetupCTABanner.stories.js | 10 ++++----- ...ReaderRevenueManagerSetupCTABanner.test.js | 12 +++++----- .../components/dashboard/index.js | 1 + 5 files changed, 24 insertions(+), 23 deletions(-) rename assets/js/modules/reader-revenue-manager/components/{ => dashboard}/ReaderRevenueManagerSetupCTABanner.js (87%) rename assets/js/modules/reader-revenue-manager/components/{ => dashboard}/ReaderRevenueManagerSetupCTABanner.stories.js (80%) rename assets/js/modules/reader-revenue-manager/components/{ => dashboard}/ReaderRevenueManagerSetupCTABanner.test.js (90%) diff --git a/assets/js/components/DashboardMainApp.js b/assets/js/components/DashboardMainApp.js index 4eb47dec24e..eb6d843d5ef 100644 --- a/assets/js/components/DashboardMainApp.js +++ b/assets/js/components/DashboardMainApp.js @@ -46,7 +46,7 @@ import { AudienceSegmentationSetupCTAWidget, AudienceSelectionPanel, } from '../modules/analytics-4/components/audience-segmentation/dashboard'; -import ReaderRevenueManagerSetupCTABanner from '../modules/reader-revenue-manager/components/ReaderRevenueManagerSetupCTABanner'; +import ReaderRevenueManagerSetupCTABanner from '../modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner'; import EntitySearchInput from './EntitySearchInput'; import DateRangeSelector from './DateRangeSelector'; import HelpMenu from './help/HelpMenu'; diff --git a/assets/js/modules/reader-revenue-manager/components/ReaderRevenueManagerSetupCTABanner.js b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.js similarity index 87% rename from assets/js/modules/reader-revenue-manager/components/ReaderRevenueManagerSetupCTABanner.js rename to assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.js index 065da50be60..c8230182fd9 100644 --- a/assets/js/modules/reader-revenue-manager/components/ReaderRevenueManagerSetupCTABanner.js +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.js @@ -37,20 +37,20 @@ import { BREAKPOINT_SMALL, BREAKPOINT_TABLET, useBreakpoint, -} from '../../../hooks/useBreakpoint'; -import useActivateModuleCallback from '../../../hooks/useActivateModuleCallback'; -import whenInactive from '../../../util/when-inactive'; -import { withWidgetComponentProps } from '../../../googlesitekit/widgets/util'; -import { CORE_USER } from '../../../googlesitekit/datastore/user/constants'; +} from '../../../../hooks/useBreakpoint'; +import useActivateModuleCallback from '../../../../hooks/useActivateModuleCallback'; +import whenInactive from '../../../../util/when-inactive'; +import { withWidgetComponentProps } from '../../../../googlesitekit/widgets/util'; +import { CORE_USER } from '../../../../googlesitekit/datastore/user/constants'; import { READER_REVENUE_MANAGER_MODULE_SLUG, READER_REVENUE_MANAGER_SETUP_BANNER_DISMISSED_KEY, -} from '../datastore/constants'; -import { Cell, Grid, Row } from '../../../material-components'; -import SetupSVG from '../../../../svg/graphics/reader-revenue-manager-setup.svg'; -import SetupTabletSVG from '../../../../svg/graphics/reader-revenue-manager-setup-tablet.svg'; -import SetupMobileSVG from '../../../../svg/graphics/reader-revenue-manager-setup-mobile.svg'; -import Link from '../../../components/Link'; +} from '../../datastore/constants'; +import { Cell, Grid, Row } from '../../../../material-components'; +import SetupSVG from '../../../../../svg/graphics/reader-revenue-manager-setup.svg'; +import SetupTabletSVG from '../../../../../svg/graphics/reader-revenue-manager-setup-tablet.svg'; +import SetupMobileSVG from '../../../../../svg/graphics/reader-revenue-manager-setup-mobile.svg'; +import Link from '../../../../components/Link'; function ReaderRevenueManagerSetupCTABanner( { Widget, WidgetNull } ) { const breakpoint = useBreakpoint(); diff --git a/assets/js/modules/reader-revenue-manager/components/ReaderRevenueManagerSetupCTABanner.stories.js b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.stories.js similarity index 80% rename from assets/js/modules/reader-revenue-manager/components/ReaderRevenueManagerSetupCTABanner.stories.js rename to assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.stories.js index cafb3a5146f..9ead02de497 100644 --- a/assets/js/modules/reader-revenue-manager/components/ReaderRevenueManagerSetupCTABanner.stories.js +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.stories.js @@ -19,12 +19,12 @@ /** * Internal dependencies */ -import { provideModules } from '../../../../../tests/js/utils'; -import { withWidgetComponentProps } from '../../../googlesitekit/widgets/util'; -import WithRegistrySetup from '../../../../../tests/js/WithRegistrySetup'; +import { provideModules } from '../../../../../../tests/js/utils'; +import { withWidgetComponentProps } from '../../../../googlesitekit/widgets/util'; +import WithRegistrySetup from '../../../../../../tests/js/WithRegistrySetup'; import ReaderRevenueManagerSetupCTABanner from './ReaderRevenueManagerSetupCTABanner'; -import { READER_REVENUE_MANAGER_MODULE_SLUG } from '../datastore/constants'; -import { CORE_USER } from '../../../googlesitekit/datastore/user/constants'; +import { READER_REVENUE_MANAGER_MODULE_SLUG } from '../../datastore/constants'; +import { CORE_USER } from '../../../../googlesitekit/datastore/user/constants'; const WidgetWithComponentProps = withWidgetComponentProps( 'readerRevenueManagerSetupCTABanner' diff --git a/assets/js/modules/reader-revenue-manager/components/ReaderRevenueManagerSetupCTABanner.test.js b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js similarity index 90% rename from assets/js/modules/reader-revenue-manager/components/ReaderRevenueManagerSetupCTABanner.test.js rename to assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js index c59fd6b6626..a6b2560a0e1 100644 --- a/assets/js/modules/reader-revenue-manager/components/ReaderRevenueManagerSetupCTABanner.test.js +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js @@ -31,16 +31,16 @@ import { fireEvent, provideModules, waitFor, -} from '../../../../../tests/js/test-utils'; -import { getWidgetComponentProps } from '../../../googlesitekit/widgets/util'; -import { CORE_USER } from '../../../googlesitekit/datastore/user/constants'; +} from '../../../../../../tests/js/test-utils'; +import { getWidgetComponentProps } from '../../../../googlesitekit/widgets/util'; +import { CORE_USER } from '../../../../googlesitekit/datastore/user/constants'; import { READER_REVENUE_MANAGER_MODULE_SLUG, READER_REVENUE_MANAGER_SETUP_BANNER_DISMISSED_KEY, -} from '../datastore/constants'; -import useActivateModuleCallback from '../../../hooks/useActivateModuleCallback'; +} from '../../datastore/constants'; +import useActivateModuleCallback from '../../../../hooks/useActivateModuleCallback'; -jest.mock( '../../../hooks/useActivateModuleCallback' ); +jest.mock( '../../../../hooks/useActivateModuleCallback' ); describe( 'ReaderRevenueManagerSetupCTABanner', () => { let registry; diff --git a/assets/js/modules/reader-revenue-manager/components/dashboard/index.js b/assets/js/modules/reader-revenue-manager/components/dashboard/index.js index 9ce9c61e18c..6cd6049cf02 100644 --- a/assets/js/modules/reader-revenue-manager/components/dashboard/index.js +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/index.js @@ -17,3 +17,4 @@ */ export { default as PublicationApprovedOverlayNotification } from './PublicationApprovedOverlayNotification'; +export { default as ReaderRevenueManagerSetupCTABanner } from './ReaderRevenueManagerSetupCTABanner'; From 99d7e1976f760c0e277ca24e11489399bfe50938 Mon Sep 17 00:00:00 2001 From: Ankit Gade Date: Wed, 7 Aug 2024 21:35:28 +0530 Subject: [PATCH 2/8] Check for requirement errors. --- .../ReaderRevenueManagerSetupCTABanner.js | 20 +++++++++++++++- ...ReaderRevenueManagerSetupCTABanner.test.js | 23 +++++++++++++++---- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.js b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.js index c8230182fd9..25d2e79d33d 100644 --- a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.js +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.js @@ -41,6 +41,7 @@ import { import useActivateModuleCallback from '../../../../hooks/useActivateModuleCallback'; import whenInactive from '../../../../util/when-inactive'; import { withWidgetComponentProps } from '../../../../googlesitekit/widgets/util'; +import { CORE_MODULES } from '../../../../googlesitekit/modules/datastore/constants'; import { CORE_USER } from '../../../../googlesitekit/datastore/user/constants'; import { READER_REVENUE_MANAGER_MODULE_SLUG, @@ -76,7 +77,24 @@ function ReaderRevenueManagerSetupCTABanner( { Widget, WidgetNull } ) { const readerRevenueManagerDocumentationURL = 'https://readerrevenue.withgoogle.com'; - if ( isDismissed || isDismissed === undefined ) { + const canActivate = useSelect( ( select ) => + select( CORE_MODULES ).canActivateModule( + READER_REVENUE_MANAGER_MODULE_SLUG + ) + ); + + const hasResolved = useSelect( ( select ) => + select( CORE_MODULES ).hasFinishedResolution( 'canActivateModule', [ + READER_REVENUE_MANAGER_MODULE_SLUG, + ] ) + ); + + if ( + ! hasResolved || + isDismissed || + isDismissed === undefined || + ! canActivate + ) { return ; } diff --git a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js index a6b2560a0e1..778fc0b5f08 100644 --- a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js @@ -26,6 +26,7 @@ import fetchMock from 'fetch-mock'; */ import ReaderRevenueManagerSetupCTABanner from './ReaderRevenueManagerSetupCTABanner'; import { + act, render, createTestRegistry, fireEvent, @@ -34,6 +35,7 @@ import { } from '../../../../../../tests/js/test-utils'; import { getWidgetComponentProps } from '../../../../googlesitekit/widgets/util'; import { CORE_USER } from '../../../../googlesitekit/datastore/user/constants'; +import { CORE_MODULES } from '../../../../googlesitekit/modules/datastore/constants'; import { READER_REVENUE_MANAGER_MODULE_SLUG, READER_REVENUE_MANAGER_SETUP_BANNER_DISMISSED_KEY, @@ -106,7 +108,11 @@ describe( 'ReaderRevenueManagerSetupCTABanner', () => { } ); it( 'should call the "useActivateModuleCallback" hook when the setup CTA is clicked', async () => { - const { getByRole, waitForRegistry } = render( + registry + .dispatch( CORE_MODULES ) + .finishResolution( 'canActivateModule', [] ); + + const { container, getByRole, waitForRegistry } = render( { await waitForRegistry(); - fireEvent.click( - getByRole( 'button', { name: /Set up Reader Revenue Manager/i } ) - ); + expect( container ).not.toBeEmptyDOMElement(); + + // eslint-disable-next-line require-await + await act( async () => { + fireEvent.click( + getByRole( 'button', { + name: /Set up Reader Revenue Manager/i, + } ) + ); + } ); - expect( activateModuleMock ).toHaveBeenCalledTimes( 1 ); + expect( activateModuleMock ).toHaveBeenCalledTimes( 3 ); } ); it( 'should call the dismiss item endpoint when the banner is dismissed', async () => { From 7b9073cab922a479458593b173b9cc8401b09cce Mon Sep 17 00:00:00 2001 From: Ankit Gade Date: Thu, 8 Aug 2024 10:32:08 +0530 Subject: [PATCH 3/8] Add test for canActivateModule. --- .../ReaderRevenueManagerSetupCTABanner.js | 13 +---- ...ReaderRevenueManagerSetupCTABanner.test.js | 50 ++++++++++++++++++- 2 files changed, 49 insertions(+), 14 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.js b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.js index 25d2e79d33d..152da4e4f77 100644 --- a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.js +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.js @@ -83,18 +83,7 @@ function ReaderRevenueManagerSetupCTABanner( { Widget, WidgetNull } ) { ) ); - const hasResolved = useSelect( ( select ) => - select( CORE_MODULES ).hasFinishedResolution( 'canActivateModule', [ - READER_REVENUE_MANAGER_MODULE_SLUG, - ] ) - ); - - if ( - ! hasResolved || - isDismissed || - isDismissed === undefined || - ! canActivate - ) { + if ( isDismissed || isDismissed === undefined || ! canActivate ) { return ; } diff --git a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js index 778fc0b5f08..1eadda8633d 100644 --- a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js @@ -110,7 +110,9 @@ describe( 'ReaderRevenueManagerSetupCTABanner', () => { it( 'should call the "useActivateModuleCallback" hook when the setup CTA is clicked', async () => { registry .dispatch( CORE_MODULES ) - .finishResolution( 'canActivateModule', [] ); + .receiveCheckRequirementsSuccess( + READER_REVENUE_MANAGER_MODULE_SLUG + ); const { container, getByRole, waitForRegistry } = render( { ); } ); - expect( activateModuleMock ).toHaveBeenCalledTimes( 3 ); + expect( activateModuleMock ).toHaveBeenCalledTimes( 1 ); } ); it( 'should call the dismiss item endpoint when the banner is dismissed', async () => { @@ -167,4 +169,48 @@ describe( 'ReaderRevenueManagerSetupCTABanner', () => { expect( fetchMock ).toHaveFetchedTimes( 1 ); } ); } ); + + it( 'should not render the Reader Revenue Manager setup CTA banner when the module requirements does not meet', async () => { + // Throw error from checkRequirements to simulate a module setup error. + provideModules( registry, [ + { + slug: READER_REVENUE_MANAGER_MODULE_SLUG, + active: false, + checkRequirements: () => { + throw { + code: 'test_error_code', + message: 'Module setup error message', + data: {}, + }; + }, + }, + ] ); + + const error = { + code: 'test_error_code', + message: 'Module setup error message', + data: {}, + }; + + registry + .dispatch( CORE_MODULES ) + .receiveCheckRequirementsError( + READER_REVENUE_MANAGER_MODULE_SLUG, + error + ); + + const { container, waitForRegistry } = render( + , + { + registry, + } + ); + + await waitForRegistry(); + + expect( container ).toBeEmptyDOMElement(); + } ); } ); From cb6be21542ab01b2085bcc27575754d99160c509 Mon Sep 17 00:00:00 2001 From: Ankit Gade Date: Thu, 8 Aug 2024 10:55:39 +0530 Subject: [PATCH 4/8] Remove redundant code. --- .../ReaderRevenueManagerSetupCTABanner.test.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js index 1eadda8633d..22c5b5471dd 100644 --- a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js @@ -186,19 +186,6 @@ describe( 'ReaderRevenueManagerSetupCTABanner', () => { }, ] ); - const error = { - code: 'test_error_code', - message: 'Module setup error message', - data: {}, - }; - - registry - .dispatch( CORE_MODULES ) - .receiveCheckRequirementsError( - READER_REVENUE_MANAGER_MODULE_SLUG, - error - ); - const { container, waitForRegistry } = render( Date: Thu, 8 Aug 2024 11:25:26 +0530 Subject: [PATCH 5/8] Remove act fucntion from test. --- .../ReaderRevenueManagerSetupCTABanner.test.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js index 22c5b5471dd..04dc61d96fc 100644 --- a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js @@ -26,7 +26,6 @@ import fetchMock from 'fetch-mock'; */ import ReaderRevenueManagerSetupCTABanner from './ReaderRevenueManagerSetupCTABanner'; import { - act, render, createTestRegistry, fireEvent, @@ -128,14 +127,11 @@ describe( 'ReaderRevenueManagerSetupCTABanner', () => { expect( container ).not.toBeEmptyDOMElement(); - // eslint-disable-next-line require-await - await act( async () => { - fireEvent.click( - getByRole( 'button', { - name: /Set up Reader Revenue Manager/i, - } ) - ); - } ); + fireEvent.click( + getByRole( 'button', { + name: /Set up Reader Revenue Manager/i, + } ) + ); expect( activateModuleMock ).toHaveBeenCalledTimes( 1 ); } ); From b13ec8e9f807382fef9c27bfd4a7923fa8f455d5 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Thu, 8 Aug 2024 14:38:13 +0530 Subject: [PATCH 6/8] Rename variable. --- .../dashboard/ReaderRevenueManagerSetupCTABanner.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.js b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.js index 152da4e4f77..bfb5c82198f 100644 --- a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.js +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.js @@ -77,13 +77,13 @@ function ReaderRevenueManagerSetupCTABanner( { Widget, WidgetNull } ) { const readerRevenueManagerDocumentationURL = 'https://readerrevenue.withgoogle.com'; - const canActivate = useSelect( ( select ) => + const canActivateRRMModule = useSelect( ( select ) => select( CORE_MODULES ).canActivateModule( READER_REVENUE_MANAGER_MODULE_SLUG ) ); - if ( isDismissed || isDismissed === undefined || ! canActivate ) { + if ( isDismissed || isDismissed === undefined || ! canActivateRRMModule ) { return ; } From d0ff27b1218dd5cd23ba7e5d1f35b95375a4dfd7 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Thu, 8 Aug 2024 14:41:28 +0530 Subject: [PATCH 7/8] Fix grammar error. --- .../dashboard/ReaderRevenueManagerSetupCTABanner.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js index 04dc61d96fc..cba99fc056b 100644 --- a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js @@ -166,7 +166,7 @@ describe( 'ReaderRevenueManagerSetupCTABanner', () => { } ); } ); - it( 'should not render the Reader Revenue Manager setup CTA banner when the module requirements does not meet', async () => { + it( 'should not render the Reader Revenue Manager setup CTA banner when the module requirements do not meet', async () => { // Throw error from checkRequirements to simulate a module setup error. provideModules( registry, [ { From d6abf7afbd16341098e593c25d099caa878282d9 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Thu, 8 Aug 2024 14:45:19 +0530 Subject: [PATCH 8/8] Improve tests. --- .../ReaderRevenueManagerSetupCTABanner.test.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js index cba99fc056b..e137b91a265 100644 --- a/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/ReaderRevenueManagerSetupCTABanner.test.js @@ -36,6 +36,7 @@ import { getWidgetComponentProps } from '../../../../googlesitekit/widgets/util' import { CORE_USER } from '../../../../googlesitekit/datastore/user/constants'; import { CORE_MODULES } from '../../../../googlesitekit/modules/datastore/constants'; import { + ERROR_CODE_NON_HTTPS_SITE, READER_REVENUE_MANAGER_MODULE_SLUG, READER_REVENUE_MANAGER_SETUP_BANNER_DISMISSED_KEY, } from '../../datastore/constants'; @@ -167,16 +168,17 @@ describe( 'ReaderRevenueManagerSetupCTABanner', () => { } ); it( 'should not render the Reader Revenue Manager setup CTA banner when the module requirements do not meet', async () => { - // Throw error from checkRequirements to simulate a module setup error. + // Throw error from checkRequirements to simulate non-HTTPS site error. provideModules( registry, [ { slug: READER_REVENUE_MANAGER_MODULE_SLUG, active: false, checkRequirements: () => { throw { - code: 'test_error_code', - message: 'Module setup error message', - data: {}, + code: ERROR_CODE_NON_HTTPS_SITE, + message: + 'The site should use HTTPS to set up Reader Revenue Manager', + data: null, }; }, },