message: Ensure Convert If/Else to Ternary handles nested
diff: @@ -81,6 +81,28 @@ describe("Convert If/Else to Ternary", () => {
  let fees = 10;
  fees += daysInAdvance > 10 ? 2 : 6;
  return fees;
  +}`
  + },
  + {
  + description: "nested, cursor on nested",
  + code: `function reservationMode(daysInAdvance) {
  + if (daysInAdvance > 10) {
  + if (isVIP) {
  + return "vip";
  + } else {
  + return "early";
  + }
  + } else {
  + return "normal";
  + }
  +}`,
  + selection: Selection.cursorAt(2, 6),
  + expected: `function reservationMode(daysInAdvance) {
  + if (daysInAdvance > 10) {
  + return isVIP ? "vip" : "early";
  + } else {
  + return "normal";
  + }
  }`
  }
  ],
  @@ -183,6 +205,21 @@ describe("Convert If/Else to Ternary", () => {
  return "early";
  }
  return "normal";
  +}`,
  + selection: Selection.cursorAt(1, 6)
  + },
  + {
  + description: "there is a nested if statement inside",
  + code: `function reservationMode(daysInAdvance) {
  + if (daysInAdvance > 10) {
  + if (isVIP) {
  + return "vip";
  + } else {
  + return "early";
  + }
  + } else {
  + return "normal";
  + }
  }`,
  selection: Selection.cursorAt(1, 6)
  }
  