/
githubmirror
/
dayjs
Обзор
Документация
Войти
/
githubmirror
/
dayjs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v1.11.16
test/constructor.test.js
26 строк
539 B
iamkun
fix: fix isDayjs check logic (#2383)
27 июл 2023, 09:08
Не верифицирован
27 июл 2023, 09:08
5f3f878
Код
Авторство
О чём код?
import MockDate from 'mockdate' import dayjs from '../src' beforeEach(() => { MockDate.set(new Date()) }) afterEach(() => { MockDate.reset() }) it('supports instanceof dayjs', () => { expect(dayjs() instanceof dayjs).toBeTruthy() }) it('$isDayjsObject', () => { const mockOtherVersionDayjsObj = { $isDayjsObject: true } expect(dayjs.isDayjs(mockOtherVersionDayjsObj)).toBeTruthy() }) it('does not break isDayjs', () => { expect(dayjs.isDayjs(dayjs())).toBeTruthy() expect(dayjs.isDayjs(new Date())).toBeFalsy() })