authelia/client/test/totp-register/totp-register.test.ts
Clement Michaud d8ff186303 Split client and server
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.
2017-10-07 00:49:42 +02:00

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);
});
});