Browse Source

Reorder test cases

pull/305/head
Jerome Wu 6 years ago
parent
commit
bc51e340cb
  1. 36
      tests/recognize.test.js

36
tests/recognize.test.js

@ -25,24 +25,6 @@ const getWorker = options => ( @@ -25,24 +25,6 @@ const getWorker = options => (
);
describe('recognize()', () => {
describe('should recognize base64 image', () => {
[
{ format: 'png', image: SIMPLE_PNG, ans: SIMPLE_TEXT },
{ format: 'jpg', image: SIMPLE_JPG, ans: SIMPLE_TEXT },
].forEach(({ format, image, ans }) => (
it(`recongize ${format} in base64`, (done) => {
const worker = getWorker();
worker
.recognize(image)
.then(({ text }) => {
expect(text).to.be(ans);
worker.terminate();
done();
});
}).timeout(30000)
));
});
describe('should recognize different langs', () => {
[
{ name: 'chinese.png', lang: 'chi_tra', ans: CHINESE_TEXT },
@ -136,6 +118,24 @@ describe('recognize()', () => { @@ -136,6 +118,24 @@ describe('recognize()', () => {
));
});
describe('should recognize base64 image', () => {
[
{ format: 'png', image: SIMPLE_PNG, ans: SIMPLE_TEXT },
{ format: 'jpg', image: SIMPLE_JPG, ans: SIMPLE_TEXT },
].forEach(({ format, image, ans }) => (
it(`recongize ${format} in base64`, (done) => {
const worker = getWorker();
worker
.recognize(image)
.then(({ text }) => {
expect(text).to.be(ans);
worker.terminate();
done();
});
}).timeout(30000)
));
});
(isBrowser ? describe.skip : describe)('should recognize image in Buffer (Node.js only)', () => {
FORMATS.forEach(format => (
it(`support ${format} format`, (done) => {

Loading…
Cancel
Save