/
githubmirror
/
hexo
Обзор
Документация
Войти
/
githubmirror
/
hexo
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/scripts/helpers/fragment_cache.ts
24 строки
762 B
D-Sketon
refactor: migrate typescript (#5417)
03 мар 2024, 11:04
Не верифицирован
03 мар 2024, 11:04
3c7729d
Код
Авторство
О чём код?
import Hexo from '../../../lib/hexo'; import fragmentCache from '../../../lib/plugins/helper/fragment_cache'; describe('fragment_cache', () => { const hexo = new Hexo(__dirname); const fragment_cache = fragmentCache(hexo); fragment_cache.call({cache: true}, 'foo', () => 123); it('cache enabled', () => { fragment_cache.call({cache: true}, 'foo').should.eql(123); }); it('cache disabled', () => { fragment_cache.call({cache: false}, 'foo', () => 456).should.eql(456); }); it('should reset cache on generateBefore', () => { fragment_cache.call({cache: true}, 'foo', () => 789).should.eql(456); // reset cache hexo.emit('generateBefore'); fragment_cache.call({cache: true}, 'foo', () => 789).should.eql(789); }); });