Skip to content
Extraits de code Groupes Projets
Non vérifiée Valider 6bd3cee2 rédigé par Sorunome's avatar Sorunome
Parcourir les fichiers

exclude mocks from some tests

parent db7cfc57
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
import {MockMember} from "./member"; import {MockMember} from "./member";
import {MockCollection} from "./collection"; import {MockCollection} from "./collection";
// we are a test file and thus need those
/* tslint:disable:no-unused-expression max-file-line-count no-any */
// Mocking TextChannel // Mocking TextChannel
export class MockChannel { export class MockChannel {
public members = new MockCollection<string, MockMember>(); public members = new MockCollection<string, MockMember>();
......
import { Collection } from "discord.js"; import { Collection } from "discord.js";
// we are a test file and thus need those
/* tslint:disable:no-unused-expression max-file-line-count no-any */
export class MockCollection<T1, T2> extends Collection<T1, T2> { export class MockCollection<T1, T2> extends Collection<T1, T2> {
public array(): T2[] { public array(): T2[] {
return [...this.values()]; return [...this.values()];
......
...@@ -3,6 +3,9 @@ import {MockGuild} from "./guild"; ...@@ -3,6 +3,9 @@ import {MockGuild} from "./guild";
import {MockUser} from "./user"; import {MockUser} from "./user";
import { EventEmitter } from "events"; import { EventEmitter } from "events";
// we are a test file and thus need those
/* tslint:disable:no-unused-expression max-file-line-count no-any */
export class MockDiscordClient { export class MockDiscordClient {
public guilds = new MockCollection<string, MockGuild>(); public guilds = new MockCollection<string, MockGuild>();
public user: MockUser; public user: MockUser;
......
import {MockDiscordClient} from "./discordclient"; import {MockDiscordClient} from "./discordclient";
// we are a test file and thus need those
/* tslint:disable:no-unused-expression max-file-line-count no-any */
export class DiscordClientFactory { export class DiscordClientFactory {
private botClient: MockDiscordClient = null; private botClient: MockDiscordClient = null;
constructor(config: any, store: any) { } constructor(config: any, store: any) { }
......
// we are a test file and thus need those
/* tslint:disable:no-unused-expression max-file-line-count no-any */
export class MockEmoji { export class MockEmoji {
constructor(public id: string = "", public name = "") { } constructor(public id: string = "", public name = "") { }
} }
...@@ -3,6 +3,9 @@ import {MockMember} from "./member"; ...@@ -3,6 +3,9 @@ import {MockMember} from "./member";
import {MockEmoji} from "./emoji"; import {MockEmoji} from "./emoji";
import {Channel} from "discord.js"; import {Channel} from "discord.js";
// we are a test file and thus need those
/* tslint:disable:no-unused-expression max-file-line-count no-any */
export class MockGuild { export class MockGuild {
public channels = new MockCollection<string, Channel>(); public channels = new MockCollection<string, Channel>();
public members = new MockCollection<string, MockMember>(); public members = new MockCollection<string, MockMember>();
......
import {MockUser} from "./user"; import {MockUser} from "./user";
import * as Discord from "discord.js"; import * as Discord from "discord.js";
// we are a test file and thus need those
/* tslint:disable:no-unused-expression max-file-line-count no-any */
export class MockMember { export class MockMember {
public id = ""; public id = "";
public presence: Discord.Presence; public presence: Discord.Presence;
......
// we are a test file and thus need those
/* tslint:disable:no-unused-expression max-file-line-count no-any */
import { Presence } from "discord.js"; import { Presence } from "discord.js";
// we are a test file and thus need those
/* tslint:disable:no-unused-expression max-file-line-count no-any */
export class MockUser { export class MockUser {
public presence: Presence; public presence: Presence;
constructor( constructor(
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter