Files
kekbot.js/jest.setup.js
T

42 lines
1.1 KiB
JavaScript
Raw Normal View History

import { jest } from '@jest/globals';
2025-02-02 14:10:51 -05:00
// Mock Discord.js Client and other commonly used classes
jest.mock('discord.js', () => ({
Client: jest.fn(() => ({
login: jest.fn().mockResolvedValue('token'),
destroy: jest.fn().mockResolvedValue(),
on: jest.fn(),
once: jest.fn(),
user: {
setActivity: jest.fn(),
2025-02-02 14:10:51 -05:00
},
})),
Collection: jest.fn(() => ({
get: jest.fn(),
set: jest.fn(),
has: jest.fn(),
delete: jest.fn(),
})),
GatewayIntentBits: {
Guilds: 1,
GuildMessages: 2,
MessageContent: 3,
},
Events: {
ClientReady: 'ready',
InteractionCreate: 'interactionCreate',
},
SlashCommandBuilder: jest.fn().mockReturnValue({
setName: jest.fn().mockReturnThis(),
setDescription: jest.fn().mockReturnThis(),
addStringOption: jest.fn().mockReturnThis(),
addIntegerOption: jest.fn().mockReturnThis(),
addUserOption: jest.fn().mockReturnThis(),
}),
2025-02-02 14:10:51 -05:00
}));
// Mock environment variables
process.env.DISCORD_TOKEN = 'mock-token';
process.env.CLIENT_ID = 'mock-client-id';
process.env.GUILD_ID = 'mock-guild-id';