mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-31 07:50:07 +00:00
* p1 of bigints change * shtuff fixes and bits * Commit from GitHub Actions (Lint) * finish bigint structs * typings fixes * Commit from GitHub Actions (Lint) * more fixes * Commit from GitHub Actions (Lint) * more fixes * Commit from GitHub Actions (Lint) * blame wolf * Commit from GitHub Actions (Lint) * foxed * Commit from GitHub Actions (Lint) * fix unit tests * Commit from GitHub Actions (Lint) * change: guildUpdate guild ID can't change * delete server has been renamed to delete guild * fixes Co-authored-by: Skillz4Killz <Skillz4Killz@users.noreply.github.com> Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>
53 lines
894 B
TypeScript
53 lines
894 B
TypeScript
import { loopObject } from "../../src/util/loop_object.ts";
|
|
import { assertEquals } from "../deps.ts";
|
|
|
|
const objWithBigints = {
|
|
a: BigInt(0),
|
|
b: "string",
|
|
c: 123,
|
|
d: [123],
|
|
e: {
|
|
f: 123,
|
|
g: BigInt(2),
|
|
},
|
|
h: null,
|
|
i: undefined,
|
|
j: 0,
|
|
// k: function () {
|
|
// return true;
|
|
// },
|
|
};
|
|
|
|
const correctlyConverted = {
|
|
a: "0",
|
|
b: "string",
|
|
c: 123,
|
|
d: [123],
|
|
e: {
|
|
f: 123,
|
|
g: "2",
|
|
},
|
|
h: null,
|
|
i: undefined,
|
|
j: 0,
|
|
// k: function () {
|
|
// return true;
|
|
// },
|
|
};
|
|
|
|
Deno.test({
|
|
name: "[utils] loop over an object with a handler",
|
|
fn() {
|
|
const converted = loopObject(
|
|
objWithBigints,
|
|
(value) => typeof value === "bigint" ? value.toString() : value,
|
|
`Running for loop in unit test function for changing bigints to strings.`,
|
|
);
|
|
|
|
assertEquals(
|
|
converted,
|
|
correctlyConverted,
|
|
);
|
|
},
|
|
});
|