Balearica
2 years ago
20 changed files with 1374 additions and 1722 deletions
@ -1,29 +1,50 @@ |
|||||||
// const { createWorker } = Tesseract;
|
// const { createWorker } = Tesseract;
|
||||||
// const worker = createWorker(OPTIONS);
|
// const worker = await createWorker(OPTIONS);
|
||||||
// before(function cb() {
|
// before(function cb() {
|
||||||
// this.timeout(0);
|
// this.timeout(0);
|
||||||
// return worker.load();
|
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
|
||||||
(IS_BROWSER ? describe : describe.skip)('Invalid paths should result in promise rejection', () => { |
(IS_BROWSER ? describe : describe.skip)('Invalid paths should result in promise rejection', () => { |
||||||
it('Invalid workerPath', async () => { |
it('Invalid workerPath', async () => { |
||||||
const OPTIONS1 = JSON.parse(JSON.stringify(OPTIONS)); |
const OPTIONS1 = JSON.parse(JSON.stringify(OPTIONS)); |
||||||
OPTIONS1.corePath = "badpath.js"; |
OPTIONS1.workerPath = "badpath.js"; |
||||||
let errorThrown; |
let errorThrown; |
||||||
try { |
// try {
|
||||||
const worker = Tesseract.createWorker(OPTIONS1); |
// const worker = await Tesseract.createWorker(OPTIONS1);
|
||||||
await worker.load() |
// errorThrown = false;
|
||||||
errorThrown = false; |
// } catch (error) {
|
||||||
} catch (error) { |
// errorThrown = true;
|
||||||
errorThrown = true; |
// }
|
||||||
} |
|
||||||
|
|
||||||
expect(errorThrown).to.equal(true); |
// Tesseract.createWorker(OPTIONS1).catch(() => errorThrown = true);
|
||||||
|
// await Tesseract.createWorker(OPTIONS1).catch(() => {
|
||||||
|
// errorThrown = true;
|
||||||
|
// })
|
||||||
|
// const func = async () => {
|
||||||
|
|
||||||
|
// await Tesseract.createWorker(OPTIONS1).catch(() => {
|
||||||
|
// errorThrown = true;
|
||||||
|
// })
|
||||||
|
// return;
|
||||||
|
// };
|
||||||
|
|
||||||
|
// await func();
|
||||||
|
|
||||||
|
await (async () => { |
||||||
|
await Tesseract.createWorker(OPTIONS1).catch((x) => { console.log("stuff") }) |
||||||
|
// .then((x) => { throw new Error('was not supposed to succeed'); })
|
||||||
|
// .catch((x) => { console.log("stuff") })
|
||||||
|
return; |
||||||
|
})(); |
||||||
|
|
||||||
|
|
||||||
|
// await func().catch(() => console.log("caught"));
|
||||||
|
|
||||||
|
// expect(errorThrown).to.equal(true);
|
||||||
|
|
||||||
// expect(func).to.throwError();
|
// expect(func).to.throwError();
|
||||||
|
|
||||||
// const ret = await (worker.load().then(() => true).catch(() => false));
|
|
||||||
// expect(ret).to.equal(false);
|
// expect(ret).to.equal(false);
|
||||||
}).timeout(TIMEOUT); |
}).timeout(TIMEOUT); |
||||||
}); |
}); |
||||||
|
Loading…
Reference in new issue