Files
discordeno/tests/util/loop_object.ts
Skillz4Killz 3d39b3878a change: ids to use bigint instead of string (#892)
* 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>
2021-05-03 18:05:18 +01:00

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,
);
},
});