add snowflake unit tests

This commit is contained in:
Skillz4Killz
2021-10-29 20:48:57 +00:00
committed by GitHub
parent db560a2dbc
commit 6b5344b9b5
2 changed files with 16 additions and 4 deletions
+15 -4
View File
@@ -1,9 +1,20 @@
import { snowflakeToBigint } from "../../src/util/bigint.ts";
import { assertEquals } from "../deps.ts";
import { bigintToSnowflake, snowflakeToBigint } from "../../src/util/bigint.ts";
import { assertEquals, assertNotEquals } from "../deps.ts";
Deno.test("[Local Test] - snowflakeToBigint ", async (t) => {
Deno.test("[Local Test] - snowflakeToBigint ", () => {
const text = "130136895395987456";
const big = 130136895395987456n;
const result = snowflakeToBigint(text);
assertEquals(big, 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);
});