"use strict";

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

test('class object', () => {
  const inputCode = `class Car {
    constructor(name, year) {
    this.name = name;
    this.year = year;
    }
}`;
  const outputCode = `class Car {
  constructor(name, year) {
    this.name = name;
    this.year = year;
  }
}`;
  expect(convertCode(inputCode)).toBe(outputCode);
});
test('using class extends', () => {
  const inputCode = `class Foo extends mixin(Array) { }
    function mixin(Super) {
       return class extends Super {
        mix() { }
    };
}`;
  const outputCode = `class Foo extends mixin(Array) {}
function mixin(Super) {
  return class extends Super {
    mix() {}
  };
}`;
  expect(convertCode(inputCode)).toBe(outputCode);
});
test('new target method', () => {
  const inputCode = `class Foo {
  constructor() {
    console.log(new.target);
  }
}
class Bar extends Foo {}
new Foo();
new Bar()`;
  const outputCode = `class Foo {
  constructor() {
    console.log(new.target);
  }
}
class Bar extends Foo {}
new Foo();
new Bar();`;
  expect(convertCode(inputCode)).toBe(outputCode);
});