"use strict";

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

test('async function', () => {
  const inputCode = `async function myDisplay() {
  let myPromise = new Promise(function(myResolve, myReject) {
    setTimeout(function() { myResolve("I love You !!"); }, 3000);
  });
  document.getElementById("demo").innerHTML = await myPromise;
}`;
  const outputCode = `async function myDisplay() {
  let myPromise = new Promise(function (myResolve, myReject) {
    setTimeout(function () {
      myResolve("I love You !!");
    }, 3000);
  });
  document.getElementById("demo").innerHTML = await myPromise;
}`;
  expect(convertCode(inputCode)).toBe(outputCode);
});