/
githubmirror
/
preact
Обзор
Документация
Войти
/
githubmirror
/
preact
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
compat/test/browser/scheduler.test.js
40 строк
1 KB
James Garbutt
test: migrate compat tests to vitest spies (#4819)
27 июн 2025, 17:58
Не верифицирован
27 июн 2025, 17:58
319d304
Код
Авторство
О чём код?
import { unstable_runWithPriority, unstable_NormalPriority, unstable_LowPriority, unstable_IdlePriority, unstable_UserBlockingPriority, unstable_ImmediatePriority, unstable_now } from 'preact/compat/scheduler'; import { vi } from 'vitest'; describe('scheduler', () => { describe('runWithPriority', () => { it('should call callback ', () => { const spy = vi.fn(); unstable_runWithPriority(unstable_IdlePriority, spy); expect(spy).toHaveBeenCalledTimes(1); unstable_runWithPriority(unstable_LowPriority, spy); expect(spy).toHaveBeenCalledTimes(2); unstable_runWithPriority(unstable_NormalPriority, spy); expect(spy).toHaveBeenCalledTimes(3); unstable_runWithPriority(unstable_UserBlockingPriority, spy); expect(spy).toHaveBeenCalledTimes(4); unstable_runWithPriority(unstable_ImmediatePriority, spy); expect(spy).toHaveBeenCalledTimes(5); }); }); describe('unstable_now', () => { it('should return number', () => { const res = unstable_now(); expect(res).is.a('number'); expect(res > 0).to.equal(true); }); }); });