import secondsToYMDconvertor from './secondsToYMDconvertor';

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

  beforeEach(() => {
    convertSecondsToDate = secondsToYMDconvertor();
  });

  test('should convert 0 seconds correctly', () => {
    const result = convertSecondsToDate(0);
    expect(result).toBeDefined();
    expect(typeof result).toBe('string');
    expect(result).toMatch(/\d{2}-\d{2}-\d{4}/);
  });

  test('should convert 86400 seconds (1 day)', () => {
    const result = convertSecondsToDate(86400);
    expect(result).toBeDefined();
    expect(typeof result).toBe('string');
  });

  test('should return formatted date string', () => {
    const result = convertSecondsToDate(0);
    const parts = result.split('-');
    expect(parts).toHaveLength(3);
    expect(parts[0]).toMatch(/\d{2}/);
    expect(parts[1]).toMatch(/\d{2}/);
    expect(parts[2]).toMatch(/\d{4}/);
  });
});
