/
githubmirror
/
tesseract.js
Обзор
Документация
Войти
/
githubmirror
/
tesseract.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tests/FS.test.mjs
25 строк
892 B
Balearica
Reworked tests to run on Chrome and Firefox, and fix #1014 and #1010 (#1015)
07 апр 2025, 11:02
Не верифицирован
07 апр 2025, 11:02
68c1c96
Код
Авторство
О чём код?
import { SIMPLE_TEXT, TIMEOUT, OPTIONS } from './constants.mjs'; describe('FS', () => { let worker; before(async function cb() { this.timeout(0); worker = await Tesseract.createWorker('eng', 1, OPTIONS); }); it('should write and read text from FS (using FS only)', async () => { const path = 'tmp.txt'; await worker.FS('writeFile', [path, SIMPLE_TEXT]); const { data } = await worker.FS('readFile', [path, { encoding: 'utf8' }]); await worker.FS('unlink', [path]); expect(data.toString()).to.be(SIMPLE_TEXT); }).timeout(TIMEOUT); it('should write and read text from FS (using writeFile, readFile)', async () => { const path = 'tmp2.txt'; await worker.writeText(path, SIMPLE_TEXT); const { data } = await worker.readText(path); await worker.removeFile(path); expect(data.toString()).to.be(SIMPLE_TEXT); }).timeout(TIMEOUT); });