<commit_before>import parse, { parseField } from './parse';

describe('parseField', () => {
  it('returns a parsed field', () => {
    const test = {
      fieldId: 4,
      fieldName: 'CCA Identifier',
      start: 13,
      end: 22,
      size: 10
    };

    const expected = {
      id: 4,
      name: 'CCA Identifier',
      range: [12, 21]
    };

    expect(parseField(test)).toEqual(expected);
  });
});

describe('parse', () => {
  it('returns a parsed config', () => {
    const test = {
      name: 'Header Record',
      size: 12,
      fields: [
        {
          fieldId: 1,
          fieldName: 'Record Descriptor',
          start: 1,
          end: 4,
          size: 4
        },
        {
          fieldId: 2,
          fieldName: 'Record Identifier',
          start: 5,
          end: 10,
          size: 6
        },
        {
          fieldId: 3,
          fieldName: 'Cycle Number',
          start: 11,
          end: 12,
          size: 2
        }
      ]
    };

    const expected = {
      name: 'Header Record',
      fields: [
        {
          id: 1,
          name: 'Record Descriptor',
          range: [0, 3]
        },
        {
          id: 2,
          name: 'Record Identifier',
          range: [4, 9]
        },
        {
          id: 3,
          name: 'Cycle Number',
          range: [10, 11]
        }
      ]
    };

    expect(parse(test)).toEqual(expected);
  });
});<commit_msg>Updates test<commit_after>import parse, { parseField } from './parse';

describe('parseField', () => {
  it('returns a parsed field', () => {
    const test = {
      fieldId: 4,
      fieldName: 'CCA Identifier',
      start: 13,
      end: 22,
      size: 10
    };

    const expected = {
      id: 4,
      name: 'CCA Identifier',
      range: [12, 21],
      convertTo: 'string'
    };

    expect(parseField(test)).toEqual(expected);
  });
});

describe('parse', () => {
  it('returns a parsed config', () => {
    const test = {
      name: 'Header Record',
      size: 12,
      fields: [
        {
          fieldId: 1,
          fieldName: 'Record Descriptor',
          start: 1,
          end: 4,
          size: 4,
          fieldType: 'date'
        },
        {
          fieldId: 2,
          fieldName: 'Record Identifier',
          start: 5,
          end: 10,
          size: 6,
          fieldType: 'number'
        },
        {
          fieldId: 3,
          fieldName: 'Cycle Number',
          start: 11,
          end: 12,
          size: 2,
          fieldType: 'array'
        }
      ]
    };

    const expected = {
      name: 'Header Record',
      fields: [
        {
          id: 1,
          name: 'Record Descriptor',
          range: [0, 3],
          convertTo: 'date'
        },
        {
          id: 2,
          name: 'Record Identifier',
          range: [4, 9],
          convertTo: 'number'
        },
        {
          id: 3,
          name: 'Cycle Number',
          range: [10, 11],
          convertTo: 'array'
        }
      ]
    };

    expect(parse(test)).toEqual(expected);
  });
});
{'fraction_non_alphanumeric': 0.14359974009096815, 'fraction_numerical': 0.02599090318388564, 'mean_word_length': 1.2606461086637297, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1845223', 'n_tokens_mistral': 1028, 'n_tokens_neox': 943, 'n_words': 237}