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
9 changes: 9 additions & 0 deletions backend/src/utils/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,14 @@ export function replaceLegacyValues(result: DBResult): DBResult {
};
}

if (typeof result.mode2 === "number") {
result.mode2 = (result.mode2 as number).toString();
}

//legacy value for english_1k
if ((result.language as string) === "english_expanded") {
result.language = "english_1k";
}

return result;
}
4 changes: 2 additions & 2 deletions frontend/__tests__/components/core/Theme.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ describe("Theme component", () => {
it("removes CSS when theme has no CSS", async () => {
themeSignalMock.mockImplementation(() => ({ name: "light" }) as any);
const { css } = renderComponent();
expect(css.getAttribute("href")).toBe("");
expect(css).not.toBeInTheDocument();
});

it("removes CSS when theme is custom", async () => {
themeSignalMock.mockImplementation(() => ({ name: "custom" }) as any);
const { css } = renderComponent();
expect(css.getAttribute("href")).toBe("");
expect(css).not.toBeInTheDocument();
});

it("handles CSS load error", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, expect } from "vitest";
import defaultResultFilters from "../../../src/ts/constants/default-result-filters";
import { mergeWithDefaultFilters } from "../../../src/ts/elements/account/result-filters";
import defaultResultFilters from "../../../../src/ts/constants/default-result-filters";
import { mergeWithDefaultFilters } from "../../../../src/ts/components/pages/account/utils";

describe("result-filters.ts", () => {
describe("utils.ts", () => {
describe("mergeWithDefaultFilters", () => {
it("should merge with default filters correctly", () => {
const tests = [
Expand Down
55 changes: 16 additions & 39 deletions frontend/__tests__/controllers/preset-controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as ConfigUtils from "../../src/ts/config/utils";
import * as Persistence from "../../src/ts/config/persistence";
import * as Notifications from "../../src/ts/states/notifications";
import * as TestLogic from "../../src/ts/test/test-logic";
import * as TagController from "../../src/ts/controllers/tag-controller";
import * as Tags from "../../src/ts/collections/tags";

describe("PresetController", () => {
describe("apply", () => {
Expand All @@ -34,12 +34,9 @@ describe("PresetController", () => {
"showSuccessNotification",
);
const testRestartMock = vi.spyOn(TestLogic, "restart");
const tagControllerClearMock = vi.spyOn(TagController, "clear");
const tagControllerSetMock = vi.spyOn(TagController, "set");
const tagControllerSaveActiveMock = vi.spyOn(
TagController,
"saveActiveToLocalStorage",
);
const tagsClearMock = vi.spyOn(Tags, "clearActiveTags");
const tagsSetMock = vi.spyOn(Tags, "setTagActive");
const tagsSaveActiveMock = vi.spyOn(Tags, "saveActiveToLocalStorage");

beforeEach(() => {
[
Expand All @@ -49,9 +46,9 @@ describe("PresetController", () => {
configGetConfigChangesMock,
notificationAddMock,
testRestartMock,
tagControllerClearMock,
tagControllerSetMock,
tagControllerSaveActiveMock,
tagsClearMock,
tagsSetMock,
tagsSaveActiveMock,
].forEach((it) => it.mockClear());

configApplyMock.mockResolvedValue();
Expand All @@ -66,7 +63,7 @@ describe("PresetController", () => {

//THEN
expect(configApplyMock).toHaveBeenCalledWith(preset.config);
expect(tagControllerClearMock).toHaveBeenCalled();
expect(tagsClearMock).toHaveBeenCalled();
expect(testRestartMock).toHaveBeenCalled();
expect(notificationAddMock).toHaveBeenCalledWith("Preset applied", {
durationMs: 2000,
Expand All @@ -84,20 +81,10 @@ describe("PresetController", () => {
await PresetController.apply(preset._id);

//THEN
expect(tagControllerClearMock).toHaveBeenCalled();
expect(tagControllerSetMock).toHaveBeenNthCalledWith(
1,
"tagOne",
true,
false,
);
expect(tagControllerSetMock).toHaveBeenNthCalledWith(
2,
"tagTwo",
true,
false,
);
expect(tagControllerSaveActiveMock).toHaveBeenCalled();
expect(tagsClearMock).toHaveBeenCalled();
expect(tagsSetMock).toHaveBeenNthCalledWith(1, "tagOne", true, false);
expect(tagsSetMock).toHaveBeenNthCalledWith(2, "tagTwo", true, false);
expect(tagsSaveActiveMock).toHaveBeenCalled();
});

it("should ignore unknown preset", async () => {
Expand Down Expand Up @@ -145,20 +132,10 @@ describe("PresetController", () => {
await PresetController.apply(preset._id);

//THEN
expect(tagControllerClearMock).toHaveBeenCalled();
expect(tagControllerSetMock).toHaveBeenNthCalledWith(
1,
"tagOne",
true,
false,
);
expect(tagControllerSetMock).toHaveBeenNthCalledWith(
2,
"tagTwo",
true,
false,
);
expect(tagControllerSaveActiveMock).toHaveBeenCalled();
expect(tagsClearMock).toHaveBeenCalled();
expect(tagsSetMock).toHaveBeenNthCalledWith(1, "tagOne", true, false);
expect(tagsSetMock).toHaveBeenNthCalledWith(2, "tagTwo", true, false);
expect(tagsSaveActiveMock).toHaveBeenCalled();
});

const givenPreset = (partialPreset: Partial<Preset>): Preset => {
Expand Down
20 changes: 10 additions & 10 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"@solid-primitives/transition-group": "1.1.2",
"@solidjs/meta": "0.29.4",
"@tanstack/pacer-lite": "0.2.1",
"@tanstack/query-db-collection": "1.0.27",
"@tanstack/solid-db": "0.2.10",
"@tanstack/solid-devtools": "0.8.0",
"@tanstack/solid-form": "1.28.4",
"@tanstack/solid-hotkeys": "0.4.2",
"@tanstack/solid-hotkeys-devtools": "0.4.3",
"@tanstack/solid-query": "5.90.23",
"@tanstack/solid-query-devtools": "5.91.3",
"@tanstack/query-db-collection": "1.0.36",
"@tanstack/solid-db": "0.2.19",
"@tanstack/solid-devtools": "0.8.2",
"@tanstack/solid-form": "1.29.1",
"@tanstack/solid-hotkeys": "0.9.1",
"@tanstack/solid-hotkeys-devtools": "0.6.6",
"@tanstack/solid-query": "5.100.3",
"@tanstack/solid-query-devtools": "5.100.3",
"@tanstack/solid-table": "8.21.3",
"@ts-rest/core": "3.52.1",
"animejs": "4.2.2",
Expand All @@ -55,7 +55,7 @@
"chart.js": "3.7.1",
"chartjs-adapter-date-fns": "3.0.0",
"chartjs-plugin-annotation": "2.2.1",
"chartjs-plugin-trendline": "3.2.0",
"chartjs-plugin-trendline": "3.2.4",
"clsx": "2.1.1",
"color-blend": "4.0.0",
"damerau-levenshtein": "1.0.8",
Expand All @@ -82,7 +82,7 @@
"@monkeytype/typescript-config": "workspace:*",
"@solidjs/testing-library": "0.8.10",
"@tailwindcss/vite": "4.2.1",
"@tanstack/eslint-plugin-query": "5.91.4",
"@tanstack/eslint-plugin-query": "5.100.3",
"@testing-library/dom": "10.4.1",
"@testing-library/jest-dom": "6.9.1",
"@testing-library/user-event": "14.6.1",
Expand Down
Loading
Loading