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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ frontend/static/webfonts-preview

.turbo
frontend/.env.sentry-build-plugin
.claude/worktrees
.claude/worktrees
1024MiB
6 changes: 3 additions & 3 deletions backend/__tests__/__integration__/dal/preset.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe("PresetDal", () => {
//WHEN / THEN
await expect(() =>
PresetDal.addPreset(uid, { name: "max", config: {} }),
).rejects.toThrowError("Too many presets");
).rejects.toThrow("Too many presets");
});
it("should add preset", async () => {
//GIVEN
Expand Down Expand Up @@ -358,7 +358,7 @@ describe("PresetDal", () => {
const uid = new ObjectId().toHexString();
await expect(() =>
PresetDal.removePreset(uid, new ObjectId().toHexString()),
).rejects.toThrowError("Preset not found");
).rejects.toThrow("Preset not found");
});
it("should remove", async () => {
//GIVEN
Expand Down Expand Up @@ -421,7 +421,7 @@ describe("PresetDal", () => {
//WHEN
await expect(() =>
PresetDal.removePreset(decoyUid, first),
).rejects.toThrowError("Preset not found");
).rejects.toThrow("Preset not found");

//THEN
const read = await PresetDal.getPresets(uid);
Expand Down
10 changes: 5 additions & 5 deletions backend/__tests__/__integration__/dal/user.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ describe("UserDal", () => {
it("should throw for unknown user", async () => {
await expect(async () =>
UserDAL.getPartialUser("1234", "stack", []),
).rejects.toThrowError("User not found\nStack: stack");
).rejects.toThrow("User not found\nStack: stack");
});

it("should get streak", async () => {
Expand Down Expand Up @@ -1228,7 +1228,7 @@ describe("UserDal", () => {
it("throws for nonexisting user", async () => {
await expect(async () =>
UserDAL.updateEmail("unknown", "test@example.com"),
).rejects.toThrowError("User not found\nStack: update email");
).rejects.toThrow("User not found\nStack: update email");
});
it("should update", async () => {
//given
Expand All @@ -1244,7 +1244,7 @@ describe("UserDal", () => {
});
describe("resetPb", () => {
it("throws for nonexisting user", async () => {
await expect(async () => UserDAL.resetPb("unknown")).rejects.toThrowError(
await expect(async () => UserDAL.resetPb("unknown")).rejects.toThrow(
"User not found\nStack: reset pb",
);
});
Expand Down Expand Up @@ -1272,7 +1272,7 @@ describe("UserDal", () => {
it("throws for nonexisting user", async () => {
await expect(async () =>
UserDAL.linkDiscord("unknown", "", ""),
).rejects.toThrowError("User not found\nStack: link discord");
).rejects.toThrow("User not found\nStack: link discord");
});
it("should update", async () => {
//given
Expand Down Expand Up @@ -1308,7 +1308,7 @@ describe("UserDal", () => {
it("throws for nonexisting user", async () => {
await expect(async () =>
UserDAL.unlinkDiscord("unknown"),
).rejects.toThrowError("User not found\nStack: unlink discord");
).rejects.toThrow("User not found\nStack: unlink discord");
});
it("should update", async () => {
//given
Expand Down
2 changes: 1 addition & 1 deletion backend/__tests__/api/controllers/admin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ describe("AdminController", () => {
data: null,
});

expect(addToInboxMock).toBeCalledTimes(2);
expect(addToInboxMock).toHaveBeenCalledTimes(2);
expect(deleteReportsMock).toHaveBeenCalledWith(["1", "2"]);
});
it("should fail wihtout mandatory properties", async () => {
Expand Down
2 changes: 1 addition & 1 deletion backend/__tests__/api/controllers/user.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,7 @@ describe("user controller test", () => {
//THEN
expect(result.body.message).toEqual("The Discord account is blocked");

expect(blocklistContainsMock).toBeCalledWith({
expect(blocklistContainsMock).toHaveBeenCalledWith({
discordId: "discordUserId",
});
});
Expand Down
22 changes: 11 additions & 11 deletions backend/__tests__/middlewares/auth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ describe("middlewares/auth", () => {
{ headers: { authorization: "ApeKey aWQua2V5" } },
{ acceptApeKeys: false },
),
).rejects.toThrowError("This endpoint does not accept ApeKeys");
).rejects.toThrow("This endpoint does not accept ApeKeys");

//THEN
});
Expand All @@ -170,7 +170,7 @@ describe("middlewares/auth", () => {
{ headers: { authorization: "ApeKey aWQua2V5" } },
{ acceptApeKeys: false },
),
).rejects.toThrowError("ApeKeys are not being accepted at this time");
).rejects.toThrow("ApeKeys are not being accepted at this time");

//THEN
});
Expand Down Expand Up @@ -253,7 +253,7 @@ describe("middlewares/auth", () => {
);
});
it("should fail without authentication", async () => {
await expect(() => authenticate({ headers: {} })).rejects.toThrowError(
await expect(() => authenticate({ headers: {} })).rejects.toThrow(
"Unauthorized\nStack: endpoint: /api/v1 no authorization header found",
);

Expand All @@ -269,7 +269,7 @@ describe("middlewares/auth", () => {
it("should fail with empty authentication", async () => {
await expect(() =>
authenticate({ headers: { authorization: "" } }),
).rejects.toThrowError(
).rejects.toThrow(
"Unauthorized\nStack: endpoint: /api/v1 no authorization header found",
);

Expand All @@ -285,7 +285,7 @@ describe("middlewares/auth", () => {
it("should fail with missing authentication token", async () => {
await expect(() =>
authenticate({ headers: { authorization: "Bearer" } }),
).rejects.toThrowError(
).rejects.toThrow(
"Missing authentication token\nStack: authenticateWithAuthHeader",
);

Expand All @@ -301,7 +301,7 @@ describe("middlewares/auth", () => {
it("should fail with unknown authentication scheme", async () => {
await expect(() =>
authenticate({ headers: { authorization: "unknown format" } }),
).rejects.toThrowError(
).rejects.toThrow(
'Unknown authentication scheme\nStack: The authentication scheme "unknown" is not implemented',
);

Expand Down Expand Up @@ -417,7 +417,7 @@ describe("middlewares/auth", () => {
//THEN
await expect(() =>
authenticate({ headers: {} }, { isPublicOnDev: true }),
).rejects.toThrowError("Unauthorized");
).rejects.toThrow("Unauthorized");
});
it("should allow with apeKey on dev public endpoint in production", async () => {
//WHEN
Expand Down Expand Up @@ -476,7 +476,7 @@ describe("middlewares/auth", () => {
},
{ isGithubWebhook: true },
),
).rejects.toThrowError("Github webhook signature invalid");
).rejects.toThrow("Github webhook signature invalid");

//THEH
expect(prometheusIncrementAuthMock).not.toHaveBeenCalled();
Expand All @@ -497,7 +497,7 @@ describe("middlewares/auth", () => {
},
{ isGithubWebhook: true },
),
).rejects.toThrowError("Missing Github signature header");
).rejects.toThrow("Missing Github signature header");

//THEH
expect(prometheusIncrementAuthMock).not.toHaveBeenCalled();
Expand All @@ -518,7 +518,7 @@ describe("middlewares/auth", () => {
},
{ isGithubWebhook: true },
),
).rejects.toThrowError("Missing Github Webhook Secret");
).rejects.toThrow("Missing Github Webhook Secret");

//THEH
expect(prometheusIncrementAuthMock).not.toHaveBeenCalled();
Expand All @@ -542,7 +542,7 @@ describe("middlewares/auth", () => {
},
{ isGithubWebhook: true },
),
).rejects.toThrowError(
).rejects.toThrow(
"Failed to authenticate Github webhook: could not validate",
);

Expand Down
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"testcontainers": "11.11.0",
"tsx": "4.21.0",
"typescript": "6.0.0-beta",
"vitest": "4.0.15"
"vitest": "4.1.0"
},
"engines": {
"node": ">=24.0.0 <25"
Expand Down
2 changes: 1 addition & 1 deletion frontend/__tests__/elements/test-activity-calendar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ describe("test-activity-calendar.ts", () => {
);

//WHEN
expect(() => calendar.increment(getDate("2024-04-09"))).toThrowError(
expect(() => calendar.increment(getDate("2024-04-09"))).toThrow(
new Error("cannot alter data in the past."),
);
});
Expand Down
4 changes: 1 addition & 3 deletions frontend/__tests__/root/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ describe("Config", () => {
it("should throw if config key in not found in metadata", () => {
expect(() => {
Config.setConfig("nonExistentKey" as ConfigKey, true);
}).toThrowError(
`Config metadata for key "nonExistentKey" is not defined.`,
);
}).toThrow(`Config metadata for key "nonExistentKey" is not defined.`);
});

it("fails if test is active and funbox no_quit", () => {
Expand Down
18 changes: 9 additions & 9 deletions frontend/__tests__/utils/sanitize.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("sanitize function", () => {
);

if (expected.numbers === false) {
sanitized.toThrowError();
sanitized.toThrow();
} else if (expected.numbers === true) {
sanitized.toStrictEqual(input);
} else {
Expand All @@ -50,7 +50,7 @@ describe("sanitize function", () => {
);

if (expected.numbersMin === false) {
sanitized.toThrowError();
sanitized.toThrow();
} else if (expected.numbersMin === true) {
sanitized.toStrictEqual(input);
} else {
Expand Down Expand Up @@ -173,7 +173,7 @@ describe("sanitize function", () => {
);

if (expected.mandatory === false) {
sanitized.toThrowError();
sanitized.toThrow();
} else if (expected.mandatory === true) {
sanitized.toStrictEqual(input);
} else {
Expand All @@ -190,7 +190,7 @@ describe("sanitize function", () => {
);

if (expected.partial === false) {
sanitized.toThrowError();
sanitized.toThrow();
} else if (expected.partial === true) {
sanitized.toStrictEqual(input);
} else {
Expand All @@ -206,7 +206,7 @@ describe("sanitize function", () => {
);

if (expected.optional === false) {
sanitized.toThrowError();
sanitized.toThrow();
} else if (expected.optional === true) {
sanitized.toStrictEqual(input);
} else {
Expand Down Expand Up @@ -300,7 +300,7 @@ describe("sanitize function", () => {
);

if (expected.mandatory === false) {
sanitized.toThrowError();
sanitized.toThrow();
} else if (expected.mandatory === true) {
sanitized.toStrictEqual(input);
} else {
Expand All @@ -315,7 +315,7 @@ describe("sanitize function", () => {
);

if (expected.partial === false) {
sanitized.toThrowError();
sanitized.toThrow();
} else if (expected.partial === true) {
sanitized.toStrictEqual(input);
} else {
Expand All @@ -332,7 +332,7 @@ describe("sanitize function", () => {
);

if (expected.minArray === false) {
sanitized.toThrowError();
sanitized.toThrow();
} else if (expected.minArray === true) {
sanitized.toStrictEqual(input);
} else {
Expand Down Expand Up @@ -377,7 +377,7 @@ describe("sanitize function", () => {
} as any;
expect(() => {
sanitize(schema.required().strip(), obj);
}).toThrowError(
}).toThrow(
"unable to sanitize: name: Required, age: Required, tags: Required, enumArray: Required",
);
});
Expand Down
9 changes: 4 additions & 5 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,22 @@
"normalize.css": "8.0.1",
"oxlint": "1.50.0",
"oxlint-tsgolint": "0.14.2",
"postcss": "8.5.6",
"postcss": "8.5.8",
"sass": "1.70.0",
"solid-js": "1.9.10",
"subset-font": "2.3.0",
"tailwindcss": "4.1.18",
"tsx": "4.21.0",
"typescript": "6.0.0-beta",
"unplugin-inject-preload": "3.0.0",
"vite": "7.1.12",
"vite": "8.0.0",
"vite-bundle-visualizer": "1.2.1",
"vite-plugin-filter-replace": "0.1.14",
"vite-plugin-html-inject": "1.1.2",
"vite-plugin-inspect": "11.3.3",
"vite-plugin-minify": "2.1.0",
"vite-plugin-pwa": "1.1.0",
"vite-plugin-solid": "2.11.10",
"vitest": "4.0.15"
"vite-plugin-solid": "2.11.11",
"vitest": "4.1.0"
},
"lint-staged": {
"*": [
Expand Down
26 changes: 23 additions & 3 deletions frontend/src/ts/components/core/DevTools.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
import { SolidQueryDevtools } from "@tanstack/solid-query-devtools";
import { JSXElement } from "solid-js";
import { type JSXElement, lazy, Suspense } from "solid-js";

let DevComponents: (() => JSXElement) | undefined;

if (import.meta.env.DEV) {
const LazyQueryDevtools = lazy(async () =>
import("@tanstack/solid-query-devtools").then((m) => ({
default: m.SolidQueryDevtools,
})),
);
const LazyDevOptionsModal = lazy(async () =>
import("../modals/DevOptionsModal").then((m) => ({
default: m.DevOptionsModal,
})),
);
DevComponents = () => (
<Suspense>
<LazyQueryDevtools />
<LazyDevOptionsModal />
</Suspense>
);
}

export function DevTools(): JSXElement {
return <SolidQueryDevtools />;
return DevComponents?.() ?? null;
}
12 changes: 1 addition & 11 deletions frontend/src/ts/components/modals/Modals.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
import { JSXElement, Show, Suspense, lazy } from "solid-js";
import { JSXElement } from "solid-js";

import { isDevEnvironment } from "../../utils/misc";
import { ContactModal } from "./ContactModal";
import { RegisterCaptchaModal } from "./RegisterCaptchaModal";
import { SupportModal } from "./SupportModal";
import { VersionHistoryModal } from "./VersionHistoryModal";

const DevOptionsModal = lazy(async () =>
import("./DevOptionsModal").then((m) => ({ default: m.DevOptionsModal })),
);

export function Modals(): JSXElement {
return (
<>
<VersionHistoryModal />
<ContactModal />
<RegisterCaptchaModal />
<SupportModal />
<Show when={isDevEnvironment()}>
<Suspense fallback={null}>
<DevOptionsModal />
</Suspense>
</Show>
</>
);
}
Loading
Loading