Skip to content

Commit 9637ad1

Browse files
fehmerMiodec
andauthored
refactor: solid keymap (@fehmer) (#8134)
Co-authored-by: Miodec <jack@monkeytype.com>
1 parent a7ee6c9 commit 9637ad1

42 files changed

Lines changed: 2737 additions & 1715 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

backend/__tests__/api/controllers/preset.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ describe("PresetController", () => {
181181
});
182182
expect(addPresetMock).not.toHaveBeenCalled();
183183
});
184-
it("should not fail with emtpy config", async () => {
184+
it("should not fail with empty config", async () => {
185185
//GIVEN
186186

187187
addPresetMock.mockResolvedValue({ presetId: "1" });
@@ -357,7 +357,7 @@ describe("PresetController", () => {
357357
},
358358
});
359359
});
360-
it("should not fail with emtpy config", async () => {
360+
it("should not fail with empty config", async () => {
361361
//GIVEN
362362

363363
editPresetMock.mockResolvedValue({} as any);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { readFileSync } from "fs";
2+
import { resolve } from "path";
3+
import { fileURLToPath } from "url";
4+
import { vi } from "vitest";
5+
6+
const BASE_DIR = resolve(fileURLToPath(import.meta.url), "../../../static");
7+
8+
async function readJson<T>(filePath: string): Promise<T> {
9+
const fullPath = resolve(BASE_DIR, filePath.replace(/^\//, ""));
10+
const data = readFileSync(fullPath, "utf-8");
11+
return JSON.parse(data) as T;
12+
}
13+
14+
vi.mock("../../src/ts/utils/json-data", async (importOriginal) => {
15+
const original = (await importOriginal()) as any;
16+
17+
// oxlint-disable-next-line typescript/no-unsafe-return
18+
return {
19+
...original,
20+
getLayout: async (name: string) => readJson(`/layouts/${name}.json`),
21+
};
22+
});

0 commit comments

Comments
 (0)