Compare commits

..

4 commits

Author SHA1 Message Date
cc6dbe313b Plan tests
All checks were successful
Test / build (push) Successful in 11s
2024-10-29 12:01:08 +00:00
0f3ecf5772 Merge branch 'develop' into feature/378-effects-concept 2024-10-29 11:40:48 +00:00
6c17a67d7a Fix linter
All checks were successful
Deploy To Stage / build (push) Successful in 10s
Deploy To Stage / deploy (push) Successful in 14s
2024-10-28 12:06:27 +00:00
e67efd4197 Upgrade packages
Some checks failed
Deploy To Stage / build (push) Failing after 9s
Deploy To Stage / deploy (push) Has been skipped
2024-10-28 12:03:12 +00:00
7 changed files with 1174 additions and 1777 deletions

View file

@ -1,45 +0,0 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
},
"globals": {
"jest": true,
"require": true,
"exports": true,
"process": true
},
"ignorePatterns": [
"dist/**/*"
]
}

55
eslint.config.mjs Normal file
View file

@ -0,0 +1,55 @@
import js from "@eslint/js";
import ts from "typescript-eslint";
export default [
{
ignores: [
"**/dist/",
"eslint.config.mjs",
"jest.config.cjs",
"jest.setup.js",
"**/.temp/**/*"
],
},
js.configs.recommended,
...ts.configs.recommended,
{
languageOptions: {
globals: {
exports: "writable",
module: "writable",
require: "writable",
process: "writable",
console: "writable",
jest: "writable",
},
ecmaVersion: 6,
sourceType: "script",
},
files: [
"./src",
"./tests"
],
rules: {
camelcase: "error",
"brace-style": ["error", "1tbs"],
"comma-dangle": ["error", "never"],
"comma-spacing": ["error", {
before: false,
after: true,
}],
"comma-style": ["error", "last"],
"arrow-body-style": ["error", "as-needed"],
"arrow-parens": ["error", "as-needed"],
"arrow-spacing": "error",
"no-var": "error",
"prefer-template": "error",
"prefer-const": "error",
},
}
];

View file

@ -27,37 +27,36 @@
"dependencies": {
"@discordjs/rest": "^2.0.0",
"@types/clone-deep": "^4.0.4",
"@types/express": "^4.17.20",
"@types/jest": "^29.0.0",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.14",
"@types/uuid": "^10.0.0",
"body-parser": "^1.20.2",
"canvas": "^2.11.2",
"clone-deep": "^4.0.1",
"cron": "^3.1.7",
"discord.js": "^14.15.3",
"discord.js": "^14.16.3",
"dotenv": "^16.0.0",
"express": "^4.18.2",
"fuse.js": "^7.0.0",
"glob": "^11.0.0",
"jest": "^29.0.0",
"jest-mock-extended": "^3.0.0",
"jimp": "^0.22.12",
"jimp": "^1.6.0",
"mysql": "^2.18.1",
"ts-jest": "^29.0.0",
"typeorm": "0.3.20",
"winston": "^3.11.0",
"winston": "^3.15.0",
"winston-daily-rotate-file": "^5.0.0",
"winston-discord-transport": "^1.3.0"
},
"resolutions": {
"**/ws": "^8.17.1"
},
"resolutions": {},
"devDependencies": {
"@types/node": "^20.0.0",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^6.16.0",
"eslint": "^8.56.0",
"np": "^9.0.0",
"typescript": "^5.0.0"
"@types/node": "^22.8.1",
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"eslint": "^9.13.0",
"np": "^10.0.7",
"typescript": "^5.0.0",
"typescript-eslint": "^8.11.0"
}
}

View file

@ -12,6 +12,7 @@ export default class Claim extends ButtonEvent {
public override async execute(interaction: ButtonInteraction) {
if (!interaction.guild || !interaction.guildId) return;
if (!interaction.channel) return;
if (!interaction.channel.isSendable()) return;
await interaction.deferUpdate();

View file

@ -3,7 +3,7 @@ import path from "path";
import AppLogger from "../client/appLogger";
import {existsSync} from "fs";
import Inventory from "../database/entities/app/Inventory";
import Jimp from "jimp";
import {Jimp} from "jimp";
interface CardInput {
id: string;
@ -46,7 +46,7 @@ export default class ImageHelper {
}
}
const image = await loadImage(await imageData.getBufferAsync("image/png"));
const image = await loadImage(await imageData.getBuffer("image/png"));
const x = i % gridWidth;
const y = Math.floor(i / gridWidth);

View file

@ -0,0 +1,63 @@
describe("AddEffectToUserInventory", () => {
describe("GIVEN effect is in database", () => {
test.todo("EXPECT effect to be updated");
test.todo("EXPECT effect to be saved");
});
describe("GIVEN effect is not in database", () => {
test.todo("EXPECT effect to be created");
test.todo("EXPECT effect to be saved");
});
});
describe("UseEffect", () => {
describe("GIVEN effect is in database", () => {
describe("GIVEN effect.WhenExpires is undefined", () => {
test.todo("EXPECT false returned");
});
describe("GIVEN now is before effect.WhenExpires", () => {
test.todo("EXPECT false returned");
});
describe("GIVEN currently used effect is inactive", () => {
test.todo("EXPECT UseEffect to be called");
test.todo("EXPECT effect to be saved");
test.todo("EXPECT true returned");
});
});
describe("GIVEN effect is not in database", () => {
test.todo("EXPECT false returned");
});
describe("GIVEN effect.Unused is 0", () => {
test.todo("EXPECT false returned");
});
});
describe("HasEffect", () => {
describe("GIVEN effect is in database", () => {
describe("GIVEN effect.WhenExpires is defined", () => {
describe("GIVEN now is before effect.WhenExpires", () => {
test.todo("EXPECT true returned");
});
describe("GIVEN now is after effect.WhenExpires", () => {
test.todo("EXPECT false returned");
});
});
describe("GIVEN effect.WhenExpires is undefined", () => {
test.todo("EXPECT false returned");
});
});
describe("GIVEN effect is not in database", () => {
test.todo("EXPECT false returned");
});
});

2756
yarn.lock

File diff suppressed because it is too large Load diff