We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2cc6eb9 commit a4fa39cCopy full SHA for a4fa39c
1 file changed
packages/totp/src/index-test.ts
@@ -328,15 +328,20 @@ export function createTOTPTests(ctx: TestContext<CryptoPlugin>): void {
328
});
329
330
it("should compute epoch as timeStep * period + t0", async () => {
331
+ const epoch = 1234567890;
332
+ const period = 30;
333
+ const t0 = 0;
334
const result = await generate({
335
secret,
- epoch: 1234567890,
- period: 30,
- t0: 0,
336
+ epoch,
337
+ period,
338
+ t0,
339
crypto,
340
format: "detailed",
341
- expect(result.epoch).toBe(result.timeStep * 30 + 0);
342
+ expect(result.epoch).toBe(result.timeStep * period + t0);
343
+ expect(result.epoch).toBeLessThanOrEqual(epoch);
344
+ expect(result.epoch % period).toBe(0);
345
346
347
it("should reflect custom t0 in epoch computation", async () => {
0 commit comments