/[sudobot]/branches/8.x/tests/mocks/message.mock.ts
ViewVC logotype

Contents of /branches/8.x/tests/mocks/message.mock.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 577 - (show annotations)
Mon Jul 29 18:52:37 2024 UTC (8 months ago) by rakinar2
File MIME type: application/typescript
File size: 676 byte(s)
chore: add old version archive branches (2.x to 9.x-dev)
1 import { Message } from "discord.js";
2 import { vi } from "vitest";
3
4 export function createMessage(content: string, userId: string, guildId: string) {
5 const mocks = {
6 reply: vi.fn(() => Promise.resolve())
7 };
8
9 const message = {
10 content,
11 author: {
12 id: userId
13 },
14 memberId: userId,
15 member: {
16 id: userId,
17 user: {
18 id: userId
19 }
20 },
21 reply: mocks.reply,
22 guildId,
23 guild: {
24 id: guildId
25 }
26 } as unknown as Message;
27
28 Object.setPrototypeOf(message, Message.prototype);
29 return [message, mocks] as const;
30 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26