Skip to content

Commit

Permalink
Add 'types' field to recognition tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis-Averin committed Feb 28, 2024
1 parent 35d086a commit 28451a9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion test/end-to-end.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Generate and recognize', () => {
assert.ok(imageSize > 0, `ImageSize=${imageSize}`);

const recognizeRequest = new Barcode.PostBarcodeRecognizeFromUrlOrContentRequest();
recognizeRequest.type = Barcode.DecodeBarcodeType.QR;
recognizeRequest.types = [Barcode.DecodeBarcodeType.QR];
recognizeRequest.preset = Barcode.PresetType.HighPerformance;
recognizeRequest.fastScanOnly = true;

Expand Down
2 changes: 1 addition & 1 deletion test/getBarcodeRecognize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('getBarcodeRecognize', () => {
assert.strictEqual(uploaded.body.uploaded[0], filename);

const recognizeRequest = new Barcode.GetBarcodeRecognizeRequest(filename);
recognizeRequest.type = Barcode.DecodeBarcodeType.Pdf417;
recognizeRequest.types = [Barcode.DecodeBarcodeType.Pdf417];
recognizeRequest.preset = Barcode.PresetType.HighPerformance;
recognizeRequest.fastScanOnly = true;

Expand Down
7 changes: 2 additions & 5 deletions test/postBarcodeRecognizeFromUrlOrContent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('postBarcodeRecognizeFromUrlOrContent', () => {

it('should recognize from body', async () => {
const request = new Barcode.PostBarcodeRecognizeFromUrlOrContentRequest();
request.type = Barcode.DecodeBarcodeType.Pdf417;
request.types = [Barcode.DecodeBarcodeType.Pdf417];
request.preset = Barcode.PresetType.HighPerformance;
request.fastScanOnly = true;

Expand All @@ -38,12 +38,9 @@ describe('postBarcodeRecognizeFromUrlOrContent', () => {

it('should fail with Timeout', async () => {
const request = new Barcode.PostBarcodeRecognizeFromUrlOrContentRequest();
request.type = Barcode.DecodeBarcodeType.Pdf417;
request.preset = Barcode.PresetType.HighPerformance;
request.fastScanOnly = true;

request.image = imageBuffer;
request.timeout = 1;

await assert.rejects(
async () => {
await api.postBarcodeRecognizeFromUrlOrContent(request);
Expand Down
2 changes: 1 addition & 1 deletion test/putBarcodeRecognizeFromBody.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('putBarcodeRecognizeFromBody', () => {
const imageBuffer = fs.readFileSync('./testdata/pdf417Sample.png');

const readerParams = new Barcode.ReaderParams();
readerParams.type = Barcode.DecodeBarcodeType.Pdf417;
readerParams.types = [Barcode.DecodeBarcodeType.Pdf417];
readerParams.preset = Barcode.PresetType.HighPerformance;
readerParams.fastScanOnly = true;

Expand Down

0 comments on commit 28451a9

Please sign in to comment.