Files
discordeno/tests/util/bigint.ts
2022-02-11 09:49:53 +00:00

21 lines
609 B
TypeScript

import { bigintToSnowflake, snowflakeToBigint } from "../../util/bigint.ts";
import { assertEquals, assertNotEquals } from "../deps.ts";
Deno.test("[Local Test] - snowflakeToBigint ", () => {
const text = "130136895395987456";
const big = 130136895395987456n;
const result = snowflakeToBigint(text);
assertEquals(big, result);
assertNotEquals(text, result);
});
Deno.test("[Local Test] - bigIntToSnowflake", () => {
const text = "130136895395987456";
const big = 130136895395987456n;
const result = bigintToSnowflake(big);
assertEquals(text, result);
assertNotEquals(big, result);
});