import uaLocale from 'date-fns/locale/ua';
import DateFnsUtils from '../../src/utils/date-fns-utils';

describe('DateFnsUtils', () => {
  const createInstance = locale => new DateFnsUtils({ locale });

  describe('getWeekDays', () => {
    it('Should start week from Sunday by default', () => {
      const instance = createInstance();
      expect(instance.getWeekdays()[0]).toEqual('Su');
    });

    it('Should start week from a day, defined by locale', () => {
      const instance = createInstance(uaLocale);
      expect(instance.getWeekdays()[0]).toEqual('пн');
    });
  });
});

import uaLocale from 'date-fns/locale/ua';
import DateFnsUtils from '../../src/utils/date-fns-utils';

describe('DateFnsUtils', () => {
  const enUtils = new DateFnsUtils();
  const uaUtils = new DateFnsUtils({ locale: uaLocale });

  describe('getWeekDays', () => {
    it('Should start week from Sunday by default', () => {
      expect(enUtils.getWeekdays()[0]).toEqual('Su');
    });

    it('Should start week from a day, defined by locale', () => {
      expect(uaUtils.getWeekdays()[0]).toEqual('пн');
    });
  });

  describe('getWeekArray', () => {
    it('Should start week from Sunday by default', () => {
      const weekArray = enUtils.getWeekArray(new Date(2018, 3));
      expect(weekArray[0][0]).toEqual(new Date(2018, 3, 1));
    });

    it('Should start week from a day, defined by locale', () => {
      const weekArray = uaUtils.getWeekArray(new Date(2018, 3));
      expect(weekArray[1][0]).toEqual(new Date(2018, 3, 2));
    });
  });
});

add tests for getWeekArray function