/
githubmirror
/
dayjs
Обзор
Документация
Войти
/
githubmirror
/
dayjs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
test/locale/et.test.js
38 строк
986 B
Harles-Herman Pilter
fix: Update et (Estonian) locale relativeTime (#790)
30 янв 2020, 17:09
Не верифицирован
30 янв 2020, 17:09
d8e0f45
Код
Авторство
О чём код?
import moment from 'moment' import MockDate from 'mockdate' import dayjs from '../../src' import relativeTime from '../../src/plugin/relativeTime' import '../../src/locale/et' dayjs.extend(relativeTime) beforeEach(() => { MockDate.set(new Date()) }) afterEach(() => { MockDate.reset() }) it('RelativeTime: Time from X', () => { const T = [ [44.4, 'second'], // a few seconds [89.5, 'second'], // a minute [43, 'minute'], // 44 minutes [21, 'hour'], // 21 hours [25, 'day'], // 25 days [10, 'month'], // 2 month [18, 'month'] // 2 years ] T.forEach((t) => { dayjs.locale('et') moment.locale('et') expect(dayjs().from(dayjs().add(t[0], t[1]))) .toBe(moment().from(moment().add(t[0], t[1]))) expect(dayjs().from(dayjs().subtract(t[0], t[1]))) .toBe(moment().from(moment().subtract(t[0], t[1]))) expect(dayjs().from(dayjs().add(t[0], t[1]), true)) .toBe(moment().from(moment().add(t[0], t[1]), true)) }) })