mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
add snowflake unit tests
This commit is contained in:
@@ -2,5 +2,6 @@ export {
|
||||
assertArrayIncludes,
|
||||
assertEquals,
|
||||
assertExists,
|
||||
assertNotEquals,
|
||||
assertThrows,
|
||||
} from "https://deno.land/std@0.113.0/testing/asserts.ts";
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user