js-waku/packages/rln/src/utils/epoch.spec.ts
Danish Arora 0a0a92bccb
feat: @waku/rln (#2244)
* chore: setup rln as a new package

* chore: migrate src

* fix: wasm loading, tests, config

* chore: fix Karma CI

* fix: bundler

* chore: copy dist resources

* chore(rln): enable all tests

* chore: increase karma timeouts
2025-02-11 15:28:00 +05:30

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