feat(groups): add fail-closed admission management
This commit is contained in:
@@ -1,5 +1,25 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { updateGuildNickname } from "../src/index";
|
||||
import { getGuildMemberIdentity, updateGuildNickname } from "../src/index";
|
||||
|
||||
describe("Discord guild identity", () => {
|
||||
it("reads the member username, global name, nickname, and immutable ID", async () => {
|
||||
const request = vi.fn<typeof fetch>().mockResolvedValue(new Response(JSON.stringify({
|
||||
nick: "Sam (Notch)",
|
||||
user: { id: "987654321098765432", username: "samcraft", global_name: "Sam" },
|
||||
}), { status: 200, headers: { "content-type": "application/json" } }));
|
||||
|
||||
await expect(getGuildMemberIdentity({
|
||||
guildId: "123456789012345678",
|
||||
discordUserId: "987654321098765432",
|
||||
botToken: "secret",
|
||||
}, request)).resolves.toEqual({
|
||||
id: "987654321098765432",
|
||||
username: "samcraft",
|
||||
globalName: "Sam",
|
||||
nickname: "Sam (Notch)",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Discord nickname updates", () => {
|
||||
it("updates a member in the configured guild using bot authentication", async () => {
|
||||
|
||||
Reference in New Issue
Block a user