Skip to content

Commit

Permalink
added issues spec for edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
yeojz committed Oct 14, 2017
1 parent 7a4478d commit 216f5ac
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
15 changes: 0 additions & 15 deletions packages/tests/issues.js

This file was deleted.

26 changes: 26 additions & 0 deletions packages/tests/issues.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

import Authenticator from 'otplib-authenticator';
import crypto from 'crypto';

describe('issues', function () {

function getOptions(epoch) {
return {
crypto,
epoch,
encoding: 'hex',
}
}

test('#7.1', function () {
const secret = 'xbja vgc6 gv4i i4qq h5ct 6stz ytcp ksiz'.replace(/\ /g, '');
const result = Authenticator.utils.token(secret, getOptions(1507953809));
expect(result).toBe('849140');
})

test('#7.2', function () {
const secret = 'SVT52XEZE2TWC2MU';
const result = Authenticator.utils.token(secret, getOptions(1507908269));
expect(result).toBe('334156');
});
});

0 comments on commit 216f5ac

Please sign in to comment.