import { getKeyPathsArray, getKeyPathStrings } from '../../utils/objectKeyPaths';

describe('getKeyPathsArray()', () => {
  test('prop w/ string value should return key only', () => {
    expect(getKeyPathsArray({ a: '' })).toEqual([ [ 'a' ] ]);
  });

  test('prop w/ numeric value should return key only', () => {
    expect(getKeyPathsArray({ a: 0 })).toEqual([ [ 'a' ] ]);
  });

  test('prop w/ array value should return key only', () => {
    const obj = {
      a: [
        '',
        {},
        [],
      ],
    };
    const result = [ [ 'a' ] ];
    expect(getKeyPathsArray(obj)).toEqual(result);
  });

  test('prop w/ object value should return array of key arrays', () => {
    expect(getKeyPathsArray({ a: { b: '' }})).toEqual([
      [ 'a' ],
      [
        'a',
        'b',
      ],
    ]);
  });
});

describe('getKeyPathStrings()', () => {
  test('keys array containing single key should return string with that key.', () => {
    expect(getKeyPathStrings([ [ 'a' ] ])).toEqual([ 'a' ]);
  });

  test('keys array with multiple keys should return string of keys delimited by `.`', () => {
    expect(getKeyPathStrings([
      [
        'a',
        'b',
      ],
    ])).toEqual([ 'a.b' ]);
  });

  test('string delimited by `.` should be returned for each keys array', () => {
    expect(getKeyPathStrings([
      [ 'a' ],
      [
        'a',
        'b',
      ],
    ])).toEqual([
      'a',
      'a.b',
    ]);
  });
});

@@ -629,108 +629,738 @@
  w/ 
-object value should return array of key arrays', () =%3E %7B%0A    expect(getKeyPathsArray(%7B a: %7B b: '' %7D%7D
+empty object should return empty array', () =%3E %7B%0A    expect(getKeyPathsArray(%7B%7D)).toEqual(%5B%5D);%0A  %7D);%0A%0A  test('prop w/ object value should return array of key arrays', () =%3E %7B%0A    expect(getKeyPathsArray(%7B a: %7B b: '' %7D%7D)).toEqual(%5B%0A      %5B 'a' %5D,%0A      %5B%0A        'a',%0A        'b',%0A      %5D,%0A    %5D);%0A  %7D);%0A%0A  test('prop w/ version should have version removed when stripVersions flag is set', () =%3E %7B%0A    expect(getKeyPathsArray(%7B a_v1: '' %7D, true)).toEqual(%5B %5B 'a' %5D %5D);%0A    expect(getKeyPathsArray(%7B 'a_v1.0': '' %7D, true)).toEqual(%5B %5B 'a' %5D %5D);%0A    expect(getKeyPathsArray(%7B a: %7B b_v1: '' %7D%7D, true)).toEqual(%5B%0A      %5B 'a' %5D,%0A      %5B%0A        'a',%0A        'b',%0A      %5D,%0A    %5D);%0A    expect(getKeyPathsArray(%7B a: %7B 'b_v1.0': '' %7D%7D, true
 )).t

Add tests for empty object and removing version numbers from keys