Skip to content

Commit

Permalink
Update test for ZXing refactor (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdtimmerman authored Apr 26, 2021
1 parent 1cfeb04 commit 0424036
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
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

0 comments on commit 0424036

Please sign in to comment.