import secondsToYMDconvertor from '../utils/secondsToYMDconvertor'; // Adjust the import path as needed

describe('secondsToYMDconvertor', () => {
  let convertSecondsToDate;

  beforeAll(() => {
    // Initialize the function
    convertSecondsToDate = secondsToYMDconvertor();
  });

  test('should convert seconds to formatted date correctly', () => {
    // Example timestamp: 1609459200 seconds is "2021-01-01"
    const seconds = 1609459200;
    const result = convertSecondsToDate(seconds);
    expect(result).toBe('01-01-2021');
  });

  test('should handle a leap year correctly', () => {
    // Example timestamp for February 29, 2020
    const seconds = 1582934400;
    const result = convertSecondsToDate(seconds);
    expect(result).toBe('29-02-2020');
  });

  test('should handle a date at the start of the year', () => {
    // Example timestamp for January 1, 2022
    const seconds = 1640995200;
    const result = convertSecondsToDate(seconds);
    expect(result).toBe('01-01-2022');
  });

  test('should handle months and days with leading zeros correctly', () => {
    // Example timestamp for March 9, 2023
    const seconds = 1678329600;
    const result = convertSecondsToDate(seconds);
    expect(result).toBe('09-03-2023');
  });
});
