Skip to content

Commit

Permalink
test: add test cases for renameFunctionParameters.spec
Browse files Browse the repository at this point in the history
  • Loading branch information
pionxzh committed Mar 27, 2024
1 parent f1f188c commit 74641f5
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions packages/ast-utils/__tests__/renameFunctionParameters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,64 @@ function foo(c, d) {
`,
)

inlineTest('should rename function parameters #2',
`
function foo(a, b) {
function a() {
return a + b;
}
return a + b;
}
`,
`
function foo(c, d) {
function a() {
return a + d;
}
return a + d;
}
`,
)

inlineTest('should rename function parameters #3',
`
function z(e, t, n) {
"use strict";
!(function e() {
if (
"undefined" != typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" == typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE
)
try {
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e);
} catch (e) {
console.error(e);
}
})();
e.exports = n(48);
}
`,
`
function z(c, d, xx) {
"use strict";
!(function e() {
if (
"undefined" != typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" == typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE
)
try {
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e);
} catch (e) {
console.error(e);
}
})();
c.exports = xx(48);
}
`,
)

inlineTest('Class',
`
function foo(a, b, x, z) {
Expand Down

0 comments on commit 74641f5

Please sign in to comment.