"use strict";

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

test('regex match indices', () => {
  const inputCode = `const regex = RegExp('foo', 'dg');
const str = 'foobar,foobaz';
const matches=[...str.matchAll(regex)];
const firstMatch = match?.[0];
const indices = firstMatcxh.indices?.[0];
`;
  const outputCode = `const regex = RegExp('foo', 'dg');
const str = 'foobar,foobaz';
const matches = [...str.matchAll(regex)];
const firstMatch = match?.[0];
const indices = firstMatcxh.indices?.[0];`;
  expect(convertCode(inputCode)).toBe(outputCode);
});