Feature/12 create tests #102

Merged
Vylpes merged 25 commits from feature/12-create-tests into develop 2022-01-30 17:03:37 +00:00
7 changed files with 2 additions and 64 deletions
Showing only changes of commit 820068bc18 - Show all commits

View file

@ -1,7 +0,0 @@
import { Command } from "../../../src/type/command";
export default class noCategory extends Command {
constructor() {
super();
}
}

View file

@ -1,8 +0,0 @@
import { Command } from "../../../src/type/command";
export default class normal extends Command {
constructor() {
super();
this._category = "General";
}
}

View file

@ -1,8 +0,0 @@
import { Command } from "../../../src/type/command";
export default class roles extends Command {
constructor() {
super();
this._roles = [ "Moderator" ];
}
}

View file

@ -1,5 +0,0 @@
import { Event } from "../../../src/type/event";
export class normal extends Event {
public override channelCreate() {}
}

View file

@ -5,9 +5,7 @@ import * as dotenv from "dotenv";
import { Events } from "../../src/client/events"; import { Events } from "../../src/client/events";
import { Util } from "../../src/client/util"; import { Util } from "../../src/client/util";
import { Command } from "../../src/type/command"; import { Command } from "../../src/type/command";
import ICommandItem from "../../src/contracts/ICommandItem";
import { mock } from "jest-mock-extended"; import { mock } from "jest-mock-extended";
import IEventItem from "../../src/contracts/IEventItem";
import { Event } from "../../src/type/event"; import { Event } from "../../src/type/event";
jest.mock("discord.js"); jest.mock("discord.js");

View file

@ -1,5 +1,5 @@
import { Events } from "../../src/client/events"; import { Events } from "../../src/client/events";
import { Message, Client, TextChannel, Guild, SnowflakeUtil, DMChannel } from "discord.js"; import { Message } from "discord.js";
import { Util } from "../../src/client/util"; import { Util } from "../../src/client/util";
import ICommandItem from "../../src/contracts/ICommandItem"; import ICommandItem from "../../src/contracts/ICommandItem";
import { Command } from "../../src/type/command"; import { Command } from "../../src/type/command";

View file

@ -1,6 +1,6 @@
import { Util } from "../../src/client/util"; import { Util } from "../../src/client/util";
import { Client, Guild, Message, Role, SnowflakeUtil, TextChannel, User } from "discord.js"; import { Client, Message } from "discord.js";
import fs from "fs"; import fs from "fs";
import { mock } from "jest-mock-extended"; import { mock } from "jest-mock-extended";
import { Command } from "../../src/type/command"; import { Command } from "../../src/type/command";
@ -22,9 +22,6 @@ describe('LoadCommand', () => {
FOLDERS_COMMANDS: 'commands', FOLDERS_COMMANDS: 'commands',
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: { member: {
@ -61,9 +58,6 @@ describe('LoadCommand', () => {
FOLDERS_COMMANDS: 'commands', FOLDERS_COMMANDS: 'commands',
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: null member: null
@ -94,9 +88,6 @@ describe('LoadCommand', () => {
FOLDERS_COMMANDS: 'commands', FOLDERS_COMMANDS: 'commands',
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: { member: {
@ -133,9 +124,6 @@ describe('LoadCommand', () => {
FOLDERS_COMMANDS: 'commands', FOLDERS_COMMANDS: 'commands',
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: { member: {
@ -176,9 +164,6 @@ describe('LoadCommand', () => {
COMMANDS_DISABLED: 'test', COMMANDS_DISABLED: 'test',
COMMANDS_DISABLED_MESSAGE: 'disabled', COMMANDS_DISABLED_MESSAGE: 'disabled',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: { member: {
@ -220,9 +205,6 @@ describe('LoadCommand', () => {
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
COMMANDS_DISABLED: 'test', COMMANDS_DISABLED: 'test',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: { member: {
@ -264,9 +246,6 @@ describe('LoadCommand', () => {
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
COMMANDS_DISABLED: 'other', COMMANDS_DISABLED: 'other',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: { member: {
@ -310,9 +289,6 @@ describe('LoadCommand', () => {
FOLDERS_COMMANDS: 'commands', FOLDERS_COMMANDS: 'commands',
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: { member: {
@ -346,10 +322,6 @@ describe('LoadEvents', () => {
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
fs.readdirSync = jest.fn().mockReturnValue(["normal.ts"]);
const client = { const client = {
on: jest.fn(), on: jest.fn(),
} as unknown as Client; } as unknown as Client;
@ -380,10 +352,6 @@ describe('LoadEvents', () => {
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
fs.readdirSync = jest.fn().mockReturnValue(["normal"]);
const client = { const client = {
on: jest.fn(), on: jest.fn(),
} as unknown as Client; } as unknown as Client;