diff --git a/src/utils.spec.ts b/src/utils.spec.ts index 892f2f1..5b6911d 100644 --- a/src/utils.spec.ts +++ b/src/utils.spec.ts @@ -1,21 +1,27 @@ import { expect, test } from "bun:test"; -import { parseBlockId, parseLimit, parseTimestamp } from "./utils.js"; +import { parseBlockId, parseLimit, parsePage, parseTimestamp } from "./utils.js"; import { config } from "./config.js"; test("parseBlockId", () => { expect(parseBlockId("0x123") as string).toBe("123"); }); -test("parseTimestamp", () => { - expect(parseTimestamp("1697587100")).toBe(1697587100); - expect(parseTimestamp("1697587100000")).toBe(1697587100); - expect(parseTimestamp("awdawd")).toBeNaN(); - expect(parseTimestamp(null)).toBeUndefined(); -}); - test("parseLimit", () => { expect(parseLimit("1")).toBe(1); expect(parseLimit("0")).toBe(1); expect(parseLimit(10)).toBe(10); expect(parseLimit(config.maxLimit + 1)).toBe(config.maxLimit); +}); + +test("parsePage", () => { + expect(parsePage("1")).toBe(1); + expect(parsePage("0")).toBe(1); + expect(parsePage(10)).toBe(10); +}); + +test("parseTimestamp", () => { + expect(parseTimestamp("1697587100")).toBe(1697587100); + expect(parseTimestamp("1697587100000")).toBe(1697587100); + expect(parseTimestamp("awdawd")).toBeNaN(); + expect(parseTimestamp(null)).toBeUndefined(); }); \ No newline at end of file