flattenListOfObjects.spec.tsx 481 B

123456789101112131415161718
  1. import flattenListOfObjects from 'sentry/utils/replays/flattenListOfObjects';
  2. test.each([
  3. [
  4. [
  5. {a: [1], b: [2]},
  6. {a: [2], c: [3]},
  7. ],
  8. {a: [1, 2], b: [2], c: [3]},
  9. ],
  10. [[{a: [1], b: []}], {a: [1], b: []}],
  11. ])('flattenListOfObjects(%p)', (a, expected) => {
  12. expect(flattenListOfObjects(a)).toEqual(expected);
  13. });
  14. test.each([[[{b: undefined}]]])('flattenListOfObjects throws with value %p', a => {
  15. expect(() => flattenListOfObjects(a)).toThrow();
  16. });