import { describe, expect, it } from 'vitest';
import { getFormDiff } from './getFormDiff';

interface TestValues {
  a: number;
  b: string;
}

describe('getFormDiff', () => {
  it.each([
    [{ a: 1, b: 'test' }, { a: 2, b: 'test' }, { a: 1 }],
    [
      { a: 1, b: 'changed' },
      { a: 2, b: 'test' },
      { a: 1, b: 'changed' },
    ],
    [{ a: 2, b: 'test' }, { a: 2, b: 'test' }, {}],
  ])(
    'finds differences in objects correctly',
    (current: TestValues, initial: TestValues, result) => {
      expect(getFormDiff(current, initial)).toEqual(result);
    },
  );
});
