mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
Client and server now have their own tsconfig so that the transpilation is only done on the part that is being modified. It also allows faster transpilation since tests are now excluded from tsconfig. They are compiled by ts-node during unit tests execution.
31 lines
846 B
TypeScript
31 lines
846 B
TypeScript
|
|
import sinon = require("sinon");
|
|
import assert = require("assert");
|
|
|
|
import UISelector = require("../../src/lib/totp-register/ui-selector");
|
|
import TOTPRegister = require("../../src/lib/totp-register/totp-register");
|
|
|
|
describe("test totp-register", function() {
|
|
let jqueryMock: any;
|
|
let windowMock: any;
|
|
before(function() {
|
|
jqueryMock = sinon.stub();
|
|
windowMock = {
|
|
QRCode: sinon.spy()
|
|
};
|
|
});
|
|
|
|
it("should create qrcode in page", function() {
|
|
const mock = {
|
|
text: sinon.stub(),
|
|
empty: sinon.stub(),
|
|
get: sinon.stub()
|
|
};
|
|
jqueryMock.withArgs(UISelector.QRCODE_ID_SELECTOR).returns(mock);
|
|
|
|
TOTPRegister.default(windowMock, jqueryMock);
|
|
|
|
assert(mock.text.calledOnce);
|
|
assert(mock.empty.calledOnce);
|
|
});
|
|
}); |