Elffuss BraidHub

kikocis/continue public

main · 1.2 KiBRawPermalink
1import { describe, expect, it, beforeEach } from "vitest";
2
3import { modeService } from "../services/ModeService.js";
4
5describe("UserInput Keyboard Shortcuts", () => {
6 beforeEach(() => {
7 // Reset to normal mode for each test
8 modeService.initialize({});
9 });
10
11 describe("mode cycling logic", () => {
12 it("should cycle through modes in correct order", () => {
13 // Initially should be normal mode
14 expect(modeService.getCurrentMode()).toBe("normal");
15
16 // Cycle to plan
17 modeService.switchMode("plan");
18 expect(modeService.getCurrentMode()).toBe("plan");
19
20 // Cycle to auto
21 modeService.switchMode("auto");
22 expect(modeService.getCurrentMode()).toBe("auto");
23
24 // Cycle back to normal
25 modeService.switchMode("normal");
26 expect(modeService.getCurrentMode()).toBe("normal");
27 });
28
29 it("should cycle through all modes sequentially", () => {
30 const modes = ["normal", "plan", "auto"] as const;
31
32 // Test cycling through all modes
33 for (let i = 0; i < modes.length * 2; i++) {
34 const expectedMode = modes[i % modes.length];
35 modeService.switchMode(expectedMode);
36 expect(modeService.getCurrentMode()).toBe(expectedMode);
37 }
38 });
39 });
40});