mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
test: remove configs.ts (#1995)
* refactortests): remove config.ts * Update mod.ts * Update mod.ts * .env file
This commit is contained in:
@@ -16,8 +16,6 @@ jobs:
|
|||||||
deno-version: ${{ matrix.deno }}
|
deno-version: ${{ matrix.deno }}
|
||||||
- name: Cache dependencies
|
- name: Cache dependencies
|
||||||
run: deno cache mod.ts
|
run: deno cache mod.ts
|
||||||
- name: Prepare configs file
|
|
||||||
run: cp configs.example.ts configs.ts
|
|
||||||
- name: Run tests if requested by maintainers
|
- 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') }}
|
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
|
run: DISCORD_TOKEN=${{ env.DISCORD_TOKEN }} deno test --unstable --coverage=coverage -A tests/mod.ts
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ jobs:
|
|||||||
deno-version: ${{ matrix.deno }}
|
deno-version: ${{ matrix.deno }}
|
||||||
- name: Cache dependencies
|
- name: Cache dependencies
|
||||||
run: deno cache mod.ts
|
run: deno cache mod.ts
|
||||||
- name: Prepare configs file
|
|
||||||
run: cp configs.example.ts configs.ts
|
|
||||||
- name: Run test script for maintainers
|
- name: Run test script for maintainers
|
||||||
if: ${{ github.actor == 'Skillz4Killz' || github.actor == 'itohatweb' }}
|
if: ${{ github.actor == 'Skillz4Killz' || github.actor == 'itohatweb' }}
|
||||||
run: deno test --unstable --coverage=coverage -A tests/mod.ts
|
run: deno test --unstable --coverage=coverage -A tests/mod.ts
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# Allows quick testing of changes and keeps stuff like tokens private
|
# Allows quick testing of changes and keeps stuff like tokens private
|
||||||
debug.ts
|
debug.ts
|
||||||
configs.ts
|
configs.ts
|
||||||
|
.env
|
||||||
|
|
||||||
# npm stuff
|
# npm stuff
|
||||||
.npmignore
|
.npmignore
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export const UNITTEST_TOKEN = "" || Deno.env.get("DISCORD_TOKEN")!;
|
|
||||||
@@ -9,3 +9,4 @@ export {
|
|||||||
} from "https://deno.land/std@0.115.1/testing/asserts.ts";
|
} 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_cache_plugin@0.0.21/mod.ts";
|
||||||
export * from "https://deno.land/x/discordeno_permissions_plugin@0.0.15/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
@@ -1,6 +1,5 @@
|
|||||||
import { UNITTEST_TOKEN } from "../configs.ts";
|
|
||||||
import { ChannelTypes, createBot, createEventHandlers, startBot } from "../mod.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 { deleteMessageWithoutReasonTest, deleteMessageWithReasonTest } from "./helpers/messages/deleteMessage.ts";
|
||||||
import { getMessagesTest } from "./helpers/messages/getMessages.ts";
|
import { getMessagesTest } from "./helpers/messages/getMessages.ts";
|
||||||
import { deleteMessagesWithoutReasonTest, deleteMessagesWithReasonTest } from "./helpers/messages/deleteMessages.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 { editChannelTests } from "./helpers/channels/editChannel.ts";
|
||||||
import { CACHED_COMMUNITY_GUILD_ID, sanitizeMode } from "./constants.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;
|
let startedAt = 0;
|
||||||
const baseBot = createBot({
|
const baseBot = createBot({
|
||||||
token: UNITTEST_TOKEN,
|
token: TOKEN,
|
||||||
botId,
|
botId,
|
||||||
events: createEventHandlers({
|
events: createEventHandlers({
|
||||||
ready: () => {
|
ready: () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user