Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test for ZXing refactor #184

Merged
merged 1 commit into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/test.html5-qrcode.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<script src="../node_modules/promise-polyfill/dist/polyfill.min.js"></script>

<!-- actual library code -->
<script src="../third_party/qrcode.min.js"></script>
<script src="../transpiled/html5-qrcode.js"></script>
<script type="application/javascript" src="../third_party/zxing-js.umd.min.js"></script>
<script type="application/javascript" src="../transpiled/html5-qrcode.js"></script>

<!-- test dependencies -->
<script src="../node_modules/mocha/mocha.js"></script>
Expand Down
11 changes: 5 additions & 6 deletions test/test.html5-qrcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,18 @@ describe('Constructor', function() {
assert.notEqual(html5Qrcode, undefined);
});

it('Constructor fails if qrcode not defined', function() {
const expectedErrorMessage = "qrcode is not defined, use the minified"
+ "/html5-qrcode.min.js for proper support";
const __getLazarSoftScanner = getLazarSoftScanner;
getLazarSoftScanner = function() { return undefined; };
it('Constructor fails if ZXing not defined', function() {
const expectedErrorMessage = "Use html5qrcode.min.js without edit, ZXing not found.";
const __ZXing = ZXing;
ZXing = undefined;
try {
new Html5Qrcode("qr");
assert.fail("exception should be thrown");
} catch (exception) {
assert.equal(exception, expectedErrorMessage);
}

getLazarSoftScanner = __getLazarSoftScanner;
ZXing = __ZXing;
});

describe('Verbosity is set', function() {
Expand Down