test: remove configs.ts (#1995)

* refactortests): remove config.ts

* Update mod.ts

* Update mod.ts

* .env file
This commit is contained in:
ITOH
2022-02-04 16:06:55 +01:00
committed by GitHub
parent 81f8e0377c
commit c2b7a6ec03
6 changed files with 9 additions and 10 deletions
-2
View File
@@ -16,8 +16,6 @@ jobs:
deno-version: ${{ matrix.deno }}
- name: Cache dependencies
run: deno cache mod.ts
- name: Prepare configs file
run: cp configs.example.ts configs.ts
- name: Run tests if requested by maintainers
if: ${{ github.event.issue.pull_request && github.event.comment.body == 'run-tests' && (github.actor == 'Skillz4Killz' || github.actor == 'itohatweb') }}
run: DISCORD_TOKEN=${{ env.DISCORD_TOKEN }} deno test --unstable --coverage=coverage -A tests/mod.ts
-2
View File
@@ -21,8 +21,6 @@ jobs:
deno-version: ${{ matrix.deno }}
- name: Cache dependencies
run: deno cache mod.ts
- name: Prepare configs file
run: cp configs.example.ts configs.ts
- name: Run test script for maintainers
if: ${{ github.actor == 'Skillz4Killz' || github.actor == 'itohatweb' }}
run: deno test --unstable --coverage=coverage -A tests/mod.ts
+1
View File
@@ -1,6 +1,7 @@
# Allows quick testing of changes and keeps stuff like tokens private
debug.ts
configs.ts
.env
# npm stuff
.npmignore
-1
View File
@@ -1 +0,0 @@
export const UNITTEST_TOKEN = "" || Deno.env.get("DISCORD_TOKEN")!;
+1
View File
@@ -9,3 +9,4 @@ export {
} from "https://deno.land/std@0.115.1/testing/asserts.ts";
export * from "https://deno.land/x/discordeno_cache_plugin@0.0.21/mod.ts";
export * from "https://deno.land/x/discordeno_permissions_plugin@0.0.15/mod.ts";
export { config as dotenv } from "https://deno.land/x/dotenv@v3.2.0/mod.ts";
+7 -5
View File
@@ -1,6 +1,5 @@
import { UNITTEST_TOKEN } from "../configs.ts";
import { ChannelTypes, createBot, createEventHandlers, startBot } from "../mod.ts";
import { assertEquals, assertExists, enableCachePlugin } from "./deps.ts";
import { assertEquals, assertExists, dotenv, enableCachePlugin } from "./deps.ts";
import { deleteMessageWithoutReasonTest, deleteMessageWithReasonTest } from "./helpers/messages/deleteMessage.ts";
import { getMessagesTest } from "./helpers/messages/getMessages.ts";
import { deleteMessagesWithoutReasonTest, deleteMessagesWithReasonTest } from "./helpers/messages/deleteMessages.ts";
@@ -30,13 +29,16 @@ import { deleteChannelOverwriteTests } from "./helpers/channels/deleteChannelOve
import { editChannelTests } from "./helpers/channels/editChannel.ts";
import { CACHED_COMMUNITY_GUILD_ID, sanitizeMode } from "./constants.ts";
if (!UNITTEST_TOKEN) throw new Error("Token was not provided.");
dotenv({ export: true });
const botId = BigInt(atob(UNITTEST_TOKEN.split(".")[0]));
let TOKEN = Deno.env.get("DISCORD_TOKEN");
if (!TOKEN) throw new Error("Token was not provided.");
const botId = BigInt(atob(TOKEN.split(".")[0]));
let startedAt = 0;
const baseBot = createBot({
token: UNITTEST_TOKEN,
token: TOKEN,
botId,
events: createEventHandlers({
ready: () => {