import { ruleTester } from '../rule-tester' ; import * as rule from '../../src/rules/no-nested-switch' ; const messageId = 'removeNestedSwitch' ; ruleTester . run ( 'switch statements should not be nested' , rule , { valid : [ { code : `switch (x) {
        case 1: a; break;
        default: b;
      };` , } , ] , invalid : [ { code : `switch (x) {
        case 1: a; break;
        case 2:
          switch (y) {
            case 3: c; break;
            default: d;
          };
          break;
        default: b;
    }` , errors : [ { messageId , line : 4 , endLine : 4 , column : 11 , endColumn : 17 , } , ] , } , { code : `switch (x) {
            case 1: a; break;
            case 2: {
              switch (y) {
                case 3: c; break;
                default: d;
              };
              switch (z) {
                case 3: c; break;
                default: d;
              };
              break;
            }
            default: b;
          }` , errors : [ { messageId , line : 4 , endLine : 4 , column : 15 , endColumn : 21 , } , { messageId , line : 8 , endLine : 8 , column : 15 , endColumn : 21 , } , ] , } , { code : `switch (x) {
            case 1: a; break;
            case 2:
              switch (y) {
                case 3: c;
                default:
                  switch (z) {
                    case 4: d; break;
                    default: e;
                }
              }
              break;
            default: b;
          }` , errors : [ { messageId , line : 4 , endLine : 4 , column : 15 , endColumn : 21 , } , { messageId , line : 7 , endLine : 7 , column : 19 , endColumn : 25 , } , ] , } , { code : `switch (x) {
            case 1: a;
            case 2: b;
            default:
              switch (y) {
                case 3: c;
                default: d;
              }
        }` , errors : [ { messageId , line : 5 , endLine : 5 , column : 15 , endColumn : 21 , } , ] , } , { code : `switch (x) {
            case 1:
              let isideFunction = () => {
                switch (y) {}
              }
          }` , errors : [ { messageId , line : 4 , endLine : 4 , column : 17 , endColumn : 23 , } , ] , } , ] , } ) ;