Skip to content

Commit

Permalink
Add test for legacy dismissal key check.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmymadon committed Jan 9, 2025
1 parent 2de7739 commit 8f1a8ed
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { CORE_MODULES } from '../../../../googlesitekit/modules/datastore/consta
import {
ERROR_CODE_NON_HTTPS_SITE,
READER_REVENUE_MANAGER_MODULE_SLUG,
READER_REVENUE_MANAGER_SETUP_BANNER_DISMISSED_KEY,
} from '../../datastore/constants';
import { VIEW_CONTEXT_MAIN_DASHBOARD } from '../../../../googlesitekit/constants';
import useActivateModuleCallback from '../../../../hooks/useActivateModuleCallback';
Expand Down Expand Up @@ -370,6 +371,22 @@ describe( 'ReaderRevenueManagerSetupCTABanner', () => {
expect( isActive ).toBe( true );
} );

it( 'is not active when the banner was dismissed with the legacy dismissal key', async () => {
registry.dispatch( CORE_USER ).receiveGetDismissedPrompts( {
[ READER_REVENUE_MANAGER_SETUP_BANNER_DISMISSED_KEY ]: {
expires: Date.now() / 1000 + WEEK_IN_SECONDS,
count: 1,
},
} );

const isActive = await notification.checkRequirements(
registry,
VIEW_CONTEXT_MAIN_DASHBOARD
);

expect( isActive ).toBe( false );
} );

it( 'is not active when the module requirements do not meet', async () => {
// Throw error from checkRequirements to simulate non-HTTPS site error.
provideModules( registry, [
Expand Down

0 comments on commit 8f1a8ed

Please sign in to comment.