import { toNumberArray, toStringArray } from './array-transform.util';

describe('array transform utils', () => {
  it('wraps a single string as an array', () => {
    expect(toStringArray({ value: '69e8d1f7d1f72ba6416d864b' } as any)).toEqual([
      '69e8d1f7d1f72ba6416d864b',
    ]);
  });

  it('parses a JSON string array', () => {
    expect(toStringArray({ value: '["a","b"]' } as any)).toEqual(['a', 'b']);
  });

  it('keeps array input as an array', () => {
    expect(toStringArray({ value: ['a', 'b'] } as any)).toEqual(['a', 'b']);
  });

  it('parses numeric arrays from JSON strings', () => {
    expect(toNumberArray({ value: '[1,2,3]' } as any)).toEqual([1, 2, 3]);
  });
});
