"use strict";

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

test('promise.allSettled()', () => {
  const inputCode = `const promise1 = Promise.resolve(3);
const promise2 = new Promise((resolve, reject) => setTimeout(reject, 100, 'foo'));
const promises = [promise1, promise2];
Promise.allSettled(promises).then((results) => results.forEach((result) => console.log(result.status)));`;
  const outputCode = `const promise1 = Promise.resolve(3);
const promise2 = new Promise((resolve, reject) => setTimeout(reject, 100, 'foo'));
const promises = [promise1, promise2];
Promise.allSettled(promises).then(results => results.forEach(result => console.log(result.status)));`;
  expect(convertCode(inputCode)).toBe(outputCode);
});