Merge branch 'unit-tests' of https://github.com/Skillz4Killz/Discordeno into unit-tests

This commit is contained in:
Skillz
2020-09-25 10:23:15 -04:00
11 changed files with 28 additions and 17 deletions

View File

@@ -1,4 +1,7 @@
{
"deno.enable": true,
"editor.formatOnSave": true
"editor.formatOnSave": true,
"deno.import_intellisense_origins": {
"https://deno.land": true
}
}

11
deps.ts Normal file
View File

@@ -0,0 +1,11 @@
export { encode } from "https://deno.land/std@0.67.0/encoding/base64.ts";
export {
WebSocket,
connectWebSocket,
isWebSocketCloseEvent,
isWebSocketPingEvent,
isWebSocketPongEvent,
} from "https://deno.land/std@0.67.0/ws/mod.ts";
export { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
export { inflate } from "https://deno.land/x/zlib.es@v1.0.0/mod.ts";
export { assertEquals } from "https://deno.land/std/testing/asserts.ts";

View File

@@ -9,7 +9,7 @@ import type {
} from "../types/discord.ts";
import { allowNextShard } from "../module/shardingManager.ts";
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
import { delay } from "../../deps.ts";
import { eventHandlers, setBotID } from "../module/client.ts";
import { structures } from "../structures/mod.ts";
import { cache } from "../utils/cache.ts";

View File

@@ -3,7 +3,7 @@ import type { MessageContent } from "../types/channel.ts";
import type { UserPayload } from "../types/guild.ts";
import type { MessageCreateOptions } from "../types/message.ts";
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
import { delay } from "../../deps.ts";
import { structures } from "../structures/mod.ts";
import { cacheHandlers } from "../controllers/cache.ts";
import { botID } from "../module/client.ts";

View File

@@ -6,19 +6,18 @@ import {
isWebSocketPingEvent,
isWebSocketPongEvent,
WebSocket,
} from "https://deno.land/std@0.67.0/ws/mod.ts";
} from "../../deps.ts";
import type { DiscordHeartbeatPayload } from "../types/discord.ts";
import type { FetchMembersOptions } from "../types/guild.ts";
import type { BotStatusRequest } from "../utils/utils.ts";
import { handleDiscordPayload } from "./shardingManager.ts";
import { GatewayOpcode } from "../types/discord.ts";
import {
eventHandlers,
botGatewayData,
} from "./client.ts";
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
import { inflate } from "https://deno.land/x/zlib.es@v1.0.0/mod.ts";
import { delay } from "../../deps.ts";
import { inflate } from "../../deps.ts";
import { Collection } from "../utils/collection.ts";
export const basicShards = new Collection<number, BasicShard>();

View File

@@ -4,7 +4,7 @@ import { baseEndpoints } from "../constants/discord.ts";
import type { RequestMethods } from "../types/fetch.ts";
import { Errors } from "../types/errors.ts";
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
import { delay } from "../../deps.ts";
const pathQueues: { [key: string]: QueuedRequest[] } = {};
const ratelimitedPaths = new Map<string, RateLimitedPath>();

View File

@@ -1,4 +1,4 @@
import type { WebSocket } from "https://deno.land/std@0.67.0/ws/mod.ts";
import type { WebSocket } from "../../deps.ts";
import type {
DiscordBotGatewayData,
DiscordHeartbeatPayload,
@@ -8,11 +8,11 @@ import type { FetchMembersOptions } from "../types/guild.ts";
import type { DebugArg } from "../types/options.ts";
import { GatewayOpcode } from "../types/discord.ts";
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
import { delay } from "../../deps.ts";
import {
connectWebSocket,
isWebSocketCloseEvent,
} from "https://deno.land/std@0.67.0/ws/mod.ts";
} from "../../deps.ts";
let shardSocket: WebSocket;

View File

@@ -20,7 +20,7 @@ import {
identifyPayload,
} from "./client.ts";
import { GatewayOpcode } from "../types/discord.ts";
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
import { delay } from "../../deps.ts";
let shardCounter = 0;
let basicSharding = false;

View File

@@ -2,7 +2,7 @@ import type { StatusType } from "../types/discord.ts";
import { ActivityType } from "../types/activity.ts";
import { sendGatewayCommand } from "../module/shardingManager.ts";
import { encode } from "https://deno.land/std@0.67.0/encoding/base64.ts";
import { encode } from "../../deps.ts";
export const sleep = (timeout: number) => {
return new Promise((resolve) => setTimeout(resolve, timeout));

View File

View File

@@ -1,7 +1,5 @@
import { createClient, Intents, botID } from "../mod.ts";
import {
assertEquals,
} from "https://deno.land/std/testing/asserts.ts";
import { assertEquals } from "../deps.ts";
import {
createGuildRole,
createServer,
@@ -9,7 +7,7 @@ import {
deleteServer,
} from "../src/handlers/guild.ts";
import { CreateGuildPayload } from "../src/types/guild.ts";
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
import { delay } from "../deps.ts";
let guildID = "";
let roleToDelete = "";