diff --git a/tests/detect.test.js b/tests/detect.test.js index d739505..4d49d86 100644 --- a/tests/detect.test.js +++ b/tests/detect.test.js @@ -15,6 +15,32 @@ const getWorker = options => ( }) ); +before(function cb(done) { + this.timeout(30000); + const load = () => ( + loadLang({ + lang: 'osd', + cacheMethod: 'write', + ...loadLangOptions, + }).then(() => { + done(); + }) + ); + if (typeof startServer !== 'undefined') { + startServer(load); + } else { + load(); + } +}); + +after((done) => { + if (typeof stopServer !== 'undefined') { + stopServer(done); + } else { + done(); + } +}); + describe('detect()', () => { it('should detect OSD', (done) => { [ diff --git a/tests/recognize.test.js b/tests/recognize.test.js index 012532b..c7559d5 100644 --- a/tests/recognize.test.js +++ b/tests/recognize.test.js @@ -22,7 +22,34 @@ const getWorker = options => ( }) ); -describe('recognize()', () => { +before(function cb(done) { + this.timeout(30000); + const load = () => ( + loadLang({ + lang: 'eng+chi_tra', + cacheMethod: 'write', + ...loadLangOptions, + }).then(() => { + done(); + }) + ); + if (typeof startServer !== 'undefined') { + startServer(load); + } else { + load(); + } +}); + +after((done) => { + if (typeof stopServer !== 'undefined') { + stopServer(done); + } else { + done(); + } +}); + +describe('recognize()',() => { + describe('should recognize different langs', () => { [ { name: 'chinese.png', lang: 'chi_tra', ans: CHINESE_TEXT },