Skip to content

Commit

Permalink
[javascript] Add test case for pmd#4129
Browse files Browse the repository at this point in the history
  • Loading branch information
adangel committed Oct 31, 2024
1 parent 3dcddba commit ec8aa18
Showing 1 changed file with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,49 @@ async function run2(){
await client.close()
}
}
]]></code>
</test-code>

<test-code>
<description>#4129 [javascript] UnnecessaryBlock FP for function declaration</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
const getAdditionalTagTrackingImpressionObj = (
profileId,
cityName,
tracking,
isAdditionalTagsAndSlicerAbTest
) => {
const action = isAdditionalTagsAndSlicerAbTest
? `TagShown${tracking}`
: ADDITIONAL_TAG_NOT_SHOWN_ACTION;
return { // unnecessary block false positive here
gaCat: SEARCH_PAGE_TRACKING_CATEGORY,
gaActImp: action,
gaLblImp: `profileId=${profileId}|Cityname=${cityName}`,
once: true,
trackImpression: true,
};
};
/* export is not supported by rhino and produces a syntax error/empty statement */
export const getAdditionalTagTrackingImpressionObj = (
profileId,
cityName,
tracking,
isAdditionalTagsAndSlicerAbTest
) => {
const action = isAdditionalTagsAndSlicerAbTest
? `TagShown${tracking}`
: ADDITIONAL_TAG_NOT_SHOWN_ACTION;
return { // unnecessary block false positive here
gaCat: SEARCH_PAGE_TRACKING_CATEGORY,
gaActImp: action,
gaLblImp: `profileId=${profileId}|Cityname=${cityName}`,
once: true,
trackImpression: true,
};
};
]]></code>
</test-code>
</test-data>

0 comments on commit ec8aa18

Please sign in to comment.