Balearica
2 years ago
8 changed files with 97 additions and 22 deletions
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<link rel="stylesheet" href="../node_modules/mocha/mocha.css"> |
||||
</head> |
||||
<body> |
||||
<div id="mocha"></div> |
||||
<script src="../node_modules/mocha/mocha.js"></script> |
||||
<script src="../node_modules/expect.js/index.js"></script> |
||||
<script src="../dist/tesseract.dev.js"></script> |
||||
<script src="./constants.js"></script> |
||||
<script>mocha.setup('bdd');</script> |
||||
<script src="./error.test.js"></script> |
||||
<script> |
||||
mocha.run(); |
||||
</script> |
||||
</body> |
||||
</html> |
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
// const { createWorker } = Tesseract;
|
||||
// const worker = createWorker(OPTIONS);
|
||||
// before(function cb() {
|
||||
// this.timeout(0);
|
||||
// return worker.load();
|
||||
// });
|
||||
|
||||
|
||||
(IS_BROWSER ? describe : describe.skip)('Invalid paths should result in promise rejection', () => { |
||||
it('Invalid workerPath', async () => { |
||||
const OPTIONS1 = JSON.parse(JSON.stringify(OPTIONS)); |
||||
OPTIONS1.corePath = "badpath.js"; |
||||
let errorThrown; |
||||
try { |
||||
const worker = Tesseract.createWorker(OPTIONS1); |
||||
await worker.load() |
||||
errorThrown = false; |
||||
} catch (error) { |
||||
errorThrown = true; |
||||
} |
||||
|
||||
expect(errorThrown).to.equal(true); |
||||
|
||||
// expect(func).to.throwError();
|
||||
|
||||
// const ret = await (worker.load().then(() => true).catch(() => false));
|
||||
// expect(ret).to.equal(false);
|
||||
}).timeout(TIMEOUT); |
||||
}); |
Loading…
Reference in new issue