Skip to content
Source
Sign inSign up
pingdotgg/t3code

Add project script actions with shortcuts, persistence, and setup-run support #57

Mergedjuliusmarmingemerged 16 commits intomain fromcodething/7a5ed533merged by juliusmarminge View on GitHub

Showing 34 changed files with 158 additions and 2 deletions (loading 33).

x
0 of 34 viewed, 34 left
158 additions and 2 deletionsapps/server/src/keybindings.test.tsModified
View file
@@ -1,8 +1,34 @@
-import { assert, describe, it } from "vitest";
+import fs from "node:fs";
+import os from "node:os";
+import path from "node:path";
+import { assert, afterEach, describe, expect, it, vi } from "vitest";
​
-import { compileResolvedKeybindingRule, parseKeybindingShortcut } from "./keybindings";
+import {
+ compileResolvedKeybindingRule,
+ parseKeybindingShortcut,
+ upsertKeybindingRule,
+} from "./keybindings";
​
describe("server keybindings", () => {
+ const tempDirs: string[] = [];
+ const logger = {
+ warn: vi.fn(),
+ };
+​
+ function makeTempDir(prefix: string): string {
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
+ tempDirs.push(dir);
+ return dir;
+ }
+​
+ afterEach(() => {
+ vi.restoreAllMocks();
+ logger.warn.mockReset();
+ for (const dir of tempDirs.splice(0, tempDirs.length)) {
+ fs.rmSync(dir, { recursive: true, force: true });