UNPKG

corde

Version:

A simple library for Discord bot tests

83 lines (82 loc) 2.8 kB
import { ColorResolvable } from "discord.js"; import { IEmoji, IMessageIdentifier, IMessageEditedIdentifier, IMessageEmbed, Primitive, IRoleIdentifier, ITestReport, ICordeBot, TestFunctionType, IMessageMatches, IRoleMatches, Colors, RolePermission, } from "../types"; import { ExpectTest } from "./matches/expectTest"; import { IMacherContructorArgs, MayReturnMatch, IExpectTestBaseParams } from "../types"; declare class BaseMatcher { protected _commandName: unknown; protected _isNot: boolean; protected _isCascade: boolean; protected _guildId?: string; protected _channelId?: string; protected _channelIdToSendCommand?: string; constructor({ commandName, isNot, isCascade, channelId, guildId, channelIdToSendCommand, }: IMacherContructorArgs); protected operationFactory<T extends ExpectTest>( trace: string, type: new (params: IExpectTestBaseParams) => T, cordeBot: ICordeBot, ...params: Parameters<T["action"]> ): Promise<ITestReport>; protected returnOrAddToCollector(testFunction: TestFunctionType): any; } export declare class MessageMatches<TReturn extends MayReturnMatch> extends BaseMatcher implements IMessageMatches<TReturn> { toEmbedMatch(embed: IMessageEmbed): TReturn; toMessageContentContains(expectedContent: string): TReturn; toReturn(expect: Primitive | IMessageEmbed): any; toEditMessage( newValue: Primitive | IMessageEmbed, messageIdentifier?: IMessageEditedIdentifier | string, ): any; toPin(messageIdentifier: string | IMessageIdentifier): any; toUnPin(messageIdentifier: string | IMessageIdentifier): any; toAddReaction( emojis: string[] | IEmoji[] | (string | IEmoji)[], messageIdentifier?: string | IMessageIdentifier, ): any; toRemoveReaction( emojis: string[] | IEmoji[] | (string | IEmoji)[], messageIdentifier?: string | IMessageIdentifier, ): any; } export declare class ToHaveResultMatcher extends BaseMatcher { toHaveResult(...tests: TestFunctionType[]): void; } export declare class RoleMatchesImpl<TReturn extends MayReturnMatch> extends BaseMatcher implements IRoleMatches<TReturn> { toRenameRole(newName: string, roleIdentifier: IRoleIdentifier | string): any; toSetRoleColor(color: ColorResolvable | Colors, roleIdentifier: string | IRoleIdentifier): any; toDeleteRole(roleIdentifier: string | IRoleIdentifier): any; toSetRoleMentionable(mentionable: boolean, roleIdentifier: string | IRoleIdentifier): any; toSetRoleHoist(hoist: boolean, roleIdentifier: string | IRoleIdentifier): any; toSetRolePosition(newPosition: number, roleIdentifier: string | IRoleIdentifier): any; toSetRolePermission( roleIdentifier: string | IRoleIdentifier, ...permissions: RolePermission[] ): any; } export {};