Files
Booster-role/src/discord/events/boostGreeting.test.ts
T
2026-06-06 03:31:36 +07:00

36 lines
1.1 KiB
TypeScript

import { describe, expect, test } from "bun:test";
import { sendBoostGreeting } from "./boostGreeting";
describe("sendBoostGreeting", () => {
test("sends boost greeting to the given channel", async () => {
const sent: string[] = [];
const channel = {
send: async (input: { content: string }): Promise<void> => {
sent.push(input.content);
},
};
await sendBoostGreeting(channel, "user-123", "channel-456");
expect(sent.length).toBe(1);
expect(sent[0]).toContain("Thank you for boosting");
expect(sent[0]).toContain("<@user-123>");
expect(sent[0]).toContain("/booster-role claim");
expect(sent[0]).toContain("<#channel-456>");
});
test("handles different user and channel IDs", async () => {
const sent: string[] = [];
const channel = {
send: async (input: { content: string }): Promise<void> => {
sent.push(input.content);
},
};
await sendBoostGreeting(channel, "other-user", "other-channel");
expect(sent[0]).toContain("<@other-user>");
expect(sent[0]).toContain("<#other-channel>");
});
});