mirror of
https://github.com/logos-messaging/js-rln.git
synced 2026-01-04 14:43:08 +00:00
18 lines
463 B
TypeScript
18 lines
463 B
TypeScript
import { expect } from "chai";
|
|
import fc from "fast-check";
|
|
|
|
import { epochBytesToInt, epochIntToBytes } from "./epoch.js";
|
|
|
|
describe("epoch serialization", () => {
|
|
it("Round trip", async function () {
|
|
await fc.assert(
|
|
fc.asyncProperty(fc.integer({ min: 0 }), async (date) => {
|
|
const bytes = epochIntToBytes(date);
|
|
const _date = epochBytesToInt(bytes);
|
|
|
|
expect(_date.valueOf()).to.eq(date.valueOf());
|
|
})
|
|
);
|
|
});
|
|
});
|