mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
import { vi } from 'vitest'
|
|
import { makeDependencies } from '../../src';
|
|
import { Client } from 'discord.js';
|
|
|
|
vi.mock('discord.js', async (importOriginal) => {
|
|
const mod = await importOriginal()
|
|
const ModalSubmitInteraction = class {
|
|
customId;
|
|
type = 5;
|
|
isModalSubmit = vi.fn();
|
|
constructor(customId) {
|
|
this.customId = customId;
|
|
}
|
|
};
|
|
const ButtonInteraction = class {
|
|
customId;
|
|
type = 3;
|
|
componentType = 2;
|
|
isButton = vi.fn();
|
|
constructor(customId) {
|
|
this.customId = customId;
|
|
}
|
|
};
|
|
const AutocompleteInteraction = class {
|
|
type = 4;
|
|
option: string;
|
|
constructor(s: string) {
|
|
this.option = s;
|
|
}
|
|
options = {
|
|
getFocused: vi.fn(),
|
|
getSubcommand: vi.fn(),
|
|
};
|
|
};
|
|
|
|
return {
|
|
Client : vi.fn(),
|
|
Collection: mod.Collection,
|
|
ComponentType: mod.ComponentType,
|
|
InteractionType: mod.InteractionType,
|
|
ApplicationCommandOptionType: mod.ApplicationCommandOptionType,
|
|
ApplicationCommandType: mod.ApplicationCommandType,
|
|
ModalSubmitInteraction,
|
|
ButtonInteraction,
|
|
AutocompleteInteraction,
|
|
ChatInputCommandInteraction: vi.fn()
|
|
};
|
|
});
|
|
|
|
await makeDependencies(({ add }) => {
|
|
add('@sern/client', { })
|
|
})
|
|
|
|
|