Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": ["prettier", "plugin:prettier/recommended"]
"extends": ["prettier"]
}
2 changes: 1 addition & 1 deletion __tests__/discord-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe("DiscordClient", () => {

describe("isValidChannel", () => {
test("returns true if the channel is not empty", () => {
const input = "channel name";
const input = "123456789012345678";
const output = true;
expect(discordClient.isValidChannel(input)).toEqual(output);
});
Expand Down
8 changes: 8 additions & 0 deletions config/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = async () => {
const CHANNEL_CHANGELOG = "123456789012345678";
const CHANNEL_MAIN = "876543210987654321";
process.env = Object.assign(process.env, {
CHANGELOG_CHANNEL: CHANNEL_CHANGELOG,
CHANNEL: CHANNEL_MAIN,
});
};
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
setupFiles: ["dotenv/config"],
globalSetup: "./config/jest.setup.js",
};
5 changes: 2 additions & 3 deletions src/DiscordClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ class DiscordClient extends Client {
};

isValidChannel = (channelName: string): boolean => {
// since they are environment variables, we can only really check that
// they are not empty
return channelName.length > 0;
// channel ids seem to always be 18 length
return channelName.length === 18;
};
}

Expand Down