"use strict";

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

test('arrow function', () => {
  const inputCode = 'const x = (x, y) => x * y;';
  const outputCode = 'const x = (x, y) => x * y;';
  expect(convertCode(inputCode)).toBe(outputCode);
});
test('array.map method', () => {
  const inputCode = 'const double = [1, 2, 3].map(num => num * 2);';
  const outputCode = 'const double = [1, 2, 3].map(num => num * 2);';
  expect(convertCode(inputCode)).toBe(outputCode);
});
test('for each', () => {
  const inputCode = `
var bob = {
    _name: "Bob",
    _friends: ["Sally", "Tom"],
    printFriends() {
       this._friends.forEach(f => console.log(this._name + " knows " + f));
    },
};`;
  const outputCode = `var bob = {
  _name: "Bob",
  _friends: ["Sally", "Tom"],
  printFriends() {
    this._friends.forEach(f => console.log(this._name + " knows " + f));
  }
};`;
  expect(convertCode(inputCode)).toBe(outputCode);
});