Skip to content

Commit

Permalink
Update widget area tests to mute the expirable items endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
benbowler committed May 28, 2024
1 parent 56f49f0 commit e99a2ae
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
provideModules,
provideUserCapabilities,
unsubscribeFromAll,
muteFetch,
} from '../../../../../tests/js/test-utils';
import {
VIEW_CONTEXT_MAIN_DASHBOARD,
Expand Down Expand Up @@ -100,6 +101,11 @@ describe( 'WidgetAreaRenderer', () => {

const connection = { connected: true };
await registry.dispatch( CORE_SITE ).receiveGetConnection( connection );

const fetchGetExpiredItems = new RegExp(
'^/google-site-kit/v1/core/user/data/expirable-items'
);
muteFetch( fetchGetExpiredItems );
} );

afterEach( () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import WidgetContextRenderer from './WidgetContextRenderer';
import { CORE_WIDGETS } from '../datastore/constants';
import {
createTestRegistry,
muteFetch,
provideModules,
render,
waitFor,
Expand Down Expand Up @@ -54,6 +55,11 @@ describe( 'WidgetContextRenderer', () => {
registry
.dispatch( CORE_WIDGETS )
.assignWidgetArea( 'TestArea1', 'TestContext' );

const fetchGetExpiredItems = new RegExp(
'^/google-site-kit/v1/core/user/data/expirable-items'
);
muteFetch( fetchGetExpiredItems );
} );

it( 'should render the registered widget areas', async () => {
Expand Down
10 changes: 7 additions & 3 deletions assets/js/googlesitekit/widgets/datastore/areas.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,16 @@ describe( 'core/widgets Widget areas', () => {
expect(
registry.select( CORE_WIDGETS ).getWidgetArea( 'TestArea' )
).toEqual( {
Icon: undefined,
priority: 10,
slug: 'TestArea',
title: 'Test Header',
subtitle: 'Cool stuff for yoursite.com',
Icon: undefined,
style: 'composite',
slug: 'TestArea',
priority: 10,
hasNewBadge: false,
CTA: undefined,
Footer: undefined,
filterActiveWidgets: undefined,
} );
} );

Expand Down
1 change: 0 additions & 1 deletion assets/js/googlesitekit/widgets/register-defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ export function registerDefaults( widgetsAPI ) {
'Track your site’s traffic over time',
'google-site-kit'
),
hasNewBadge: true, // TODO: remove this as this is only for testing the new badge with a title.
style: WIDGET_AREA_STYLES.BOXES,
priority: 1,
},
Expand Down

0 comments on commit e99a2ae

Please sign in to comment.