/[sudobot]/trunk/tests/mocks/message.mock.ts
ViewVC logotype

Annotation of /trunk/tests/mocks/message.mock.ts

Parent Directory Parent Directory | Revision Log Revision Log


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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26