diff --git a/packages/babel-plugin-bugfix-webkit-id-destructuring-collision-in-function-expression/test/util.test.js b/packages/babel-plugin-bugfix-webkit-id-destructuring-collision-in-function-expression/test/util.test.js index 30ef0fc9e6d4..597f58fb901f 100644 --- a/packages/babel-plugin-bugfix-webkit-id-destructuring-collision-in-function-expression/test/util.test.js +++ b/packages/babel-plugin-bugfix-webkit-id-destructuring-collision-in-function-expression/test/util.test.js @@ -26,6 +26,7 @@ describe("shouldTransform", () => { "(function a({a}) {})", "(function a(...a) {})", "(function a([a = 1]) {})", + "(function a(b, { a: [,...a] }) {})", ]; const negativeCases = [ @@ -33,19 +34,22 @@ describe("shouldTransform", () => { "(function a() {})", "(function a(a) {})", "(function a() { var a })", + "(function b([a]) { var a })", + "(function b([a]) { function a() {} })", "(function a(x = a) {})", "(function a() { var { a } = {}; })", + "(function b([a]) { var { a } = {}; })", + "(function a({ [a]: b }) {})", ]; - describe("default parser options", () => { - test.each(positiveCases)("shouldTransform(%p) should return 'a'", input => { + describe("the following cases should be transformed", () => { + test.each(positiveCases)("%p", input => { expect(shouldTransform(getPath(input))).toBe("a"); }); - test.each(negativeCases)( - "shouldTransform(in %p) should return false", - input => { - expect(shouldTransform(getPath(input))).toBe(false); - }, - ); + }); + describe("the following cases should not be transformed", () => { + test.each(negativeCases)("%p", input => { + expect(shouldTransform(getPath(input))).toBe(false); + }); }); });