Skip to content

Commit

Permalink
Fix: JS tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitrox committed Feb 10, 2025
1 parent ddf7942 commit 609f309
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ describe( 'TopCategoriesWidget', () => {
dimensions: [ 'customEvent:googlesitekit_post_categories' ],
dimensionFilters: {
'customEvent:googlesitekit_post_categories': {
filterType: 'stringFilter',
matchType: 'EXACT',
value: '(not set)',
notExpression: true,
filterType: 'emptyFilter',
value: '',
notExpression: false,
},
},
metrics: [ { name: 'screenPageViews' } ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports[`TopCategoriesWidget renders correctly with the expected metrics 1`] = `
class="googlesitekit-table__body-item"
>
<strong>
80
31
</strong>
</div>
</div>
Expand All @@ -61,14 +61,14 @@ exports[`TopCategoriesWidget renders correctly with the expected metrics 1`] = `
<p
class="googlesitekit-km-widget-tile__table-plain-text"
>
Wealth
Entertainment, Sports, Media
</p>
</div>
<div
class="googlesitekit-table__body-item"
>
<strong>
63
17
</strong>
</div>
</div>
Expand All @@ -81,14 +81,14 @@ exports[`TopCategoriesWidget renders correctly with the expected metrics 1`] = `
<p
class="googlesitekit-km-widget-tile__table-plain-text"
>
Entertainment, Sports, Media
Wealth
</p>
</div>
<div
class="googlesitekit-table__body-item"
>
<strong>
3
12
</strong>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ describe( 'modules/analytics-4 custom-dimensions-gathering-data', () => {
{
dimensionValues: [
{
value: '(not set)',
value: '789',
},
],
metricValues: [
Expand Down Expand Up @@ -207,40 +207,6 @@ describe( 'modules/analytics-4 custom-dimensions-gathering-data', () => {
},
};

const dataAvailabilityReportWithNoSetValues = {
dimensionHeaders: [
{
name: `customEvent:${ customDimension }`,
},
],
metricHeaders: [
{
name: 'eventCount',
type: 'TYPE_INTEGER',
},
],
rows: [
{
dimensionValues: [
{
value: '(not set)',
},
],
metricValues: [
{
value: '123',
},
],
},
],
rowCount: 1,
metadata: {
currencyCode: 'USD',
timeZone: 'Europe/London',
},
kind: 'analyticsData#runReport',
};

let previousSiteKitModulesData;

beforeEach( () => {
Expand Down Expand Up @@ -325,8 +291,15 @@ describe( 'modules/analytics-4 custom-dimensions-gathering-data', () => {
startDate: createDate,
endDate: referenceDate,
dimensions: [ `customEvent:${ customDimension }` ],
dimensionFilters: {
[ `customEvent:${ customDimension }` ]: {
filterType: 'emptyFilter',
value: '',
notExpression: false,
},
},
metrics: [ { name: 'eventCount' } ],
limit: 2,
limit: 1,
};

if ( report ) {
Expand Down Expand Up @@ -423,14 +396,6 @@ describe( 'modules/analytics-4 custom-dimensions-gathering-data', () => {
} );
},
],
[
'the report contains no set values',
() => {
setupCustomDimensionDataAvailability( {
report: dataAvailabilityReportWithNoSetValues,
} );
},
],
] )(
'should set gathering data to be TRUE and not dispatch a fetch request to save it when %s',
async ( _, setupTest ) => {
Expand Down

0 comments on commit 609f309

Please sign in to comment.