2017-06-29 15:06:25 +08:00
|
|
|
var totp = require('../lib/totp');
|
|
|
|
var assert = require('assert');
|
|
|
|
|
|
|
|
describe('TOTP module test', function() {
|
|
|
|
|
|
|
|
var TOTP = totp.TOTP;
|
2017-06-30 11:14:15 +08:00
|
|
|
var a = new TOTP("J22U6B3WIWRRBTAV");
|
2017-06-29 15:06:25 +08:00
|
|
|
|
|
|
|
describe('now() function', function() {
|
|
|
|
it("should print 'TOTP.now'", function() {
|
2017-06-30 11:14:15 +08:00
|
|
|
assert.equal("string", typeof(a.now()));
|
2017-06-29 15:06:25 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('verify() function', function() {
|
2017-06-30 14:21:19 +08:00
|
|
|
it("should verify the digit", function() {
|
2018-11-06 11:24:34 +08:00
|
|
|
assert.equal(true, a.verify(parseInt(a.now())));
|
2017-06-29 15:06:25 +08:00
|
|
|
})
|
2017-07-10 12:18:10 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('url_gen() function', function() {
|
|
|
|
it("should return string", function() {
|
|
|
|
assert.equal("string", typeof(a.url_gen()));
|
|
|
|
})
|
2017-06-29 15:06:25 +08:00
|
|
|
})
|
|
|
|
});
|