"use strict";

const {
  convertCode
} = require('../utilities');

test('static fields and methods', () => {
  const inputCode = `class MyMath{
    static PI = 3.14159;
    static #E = 2.7899;
    static #calc(){
        return 10;
    }
}`;
  const outputCode = `class MyMath {
  static PI = 3.14159;
  static #E = 2.7899;
  static #calc() {
    return 10;
  }
}`;
  expect(convertCode(inputCode)).toBe(outputCode);
});
test('static Block', () => {
  const inputCode = `class Dictionary {
    static words = [
        {
            type:'animal',
            value:'cat'
        }
    ];
    static animals = [];
    static {
        this.words.forEach(word=>{
           if(word.type === 'animal'){
              this.animals.push(word.value)
           }
        })
    }
}`;
  const outputCode = `class Dictionary {
  static words = [{
    type: 'animal',
    value: 'cat'
  }];
  static animals = [];
  static #_ = this.words.forEach(word => {
    if (word.type === 'animal') {
      this.animals.push(word.value);
    }
  });
}`;
  expect(convertCode(inputCode)).toBe(outputCode);
});