chore: add type definition

This commit is contained in:
yugasun
2022-10-11 14:03:24 +08:00
parent e6fb08352f
commit c236e43f21
7 changed files with 7615 additions and 2 deletions
+26
View File
@@ -0,0 +1,26 @@
import QrcodeDecoder from '../';
describe('QrcodeDecoder', () => {
test('use', async () => {
const res = await import('../dist');
expect(res.default).toEqual(QrcodeDecoder);
});
test('new QrcodeDecoder()', async () => {
const qr = new QrcodeDecoder();
expect(qr).toBeDefined();
expect(qr.videoConstraints).toEqual({
video: {
width: { min: 360, ideal: 720, max: 1080 },
height: { min: 360, ideal: 720, max: 1080 },
facingMode: { exact: 'environment' },
},
audio: false,
});
expect(qr.decodeFromImage).toBeDefined();
expect(qr.decodeFromCamera).toBeDefined();
expect(qr.decodeFromVideo).toBeDefined();
});
});