- Replace `expect` assertions with `assert` in server and contracts keybinding tests - Keep existing coverage while standardizing assertion style
Unified · Split
| @@ -1,10 +1,10 @@ | ||
| 1 | −import { describe, expect, it } from "vitest"; | |
| 1 | +import { assert, describe, it } from "vitest"; | |
| 2 | 2 | |
| 3 | 3 | import { compileResolvedKeybindingRule, parseKeybindingShortcut } from "./keybindings"; |
| 4 | 4 | |
| 5 | 5 | describe("server keybindings", () => { |
| 6 | 6 | it("parses shortcuts including plus key", () => { |
| 7 | − expect(parseKeybindingShortcut("mod+j")).toEqual({ | |
| 7 | + assert.deepEqual(parseKeybindingShortcut("mod+j"), { | |
| 8 | 8 | key: "j", |
| 9 | 9 | metaKey: false, |
| 10 | 10 | ctrlKey: false, |
| @@ -12,7 +12,7 @@ describe("server keybindings", () => { · 1 unmodified line | ||
| 12 | 12 | altKey: false, |
| 13 | 13 | modKey: true, |
| 14 | 14 | }); |
| 15 | − expect(parseKeybindingShortcut("mod++")).toEqual({ | |
| 15 | + assert.deepEqual(parseKeybindingShortcut("mod++"), { | |
| 16 | 16 | key: "+", |
| 17 | 17 | metaKey: false, |
| 18 | 18 | ctrlKey: false, |
| @@ -29,7 +29,7 @@ describe("server keybindings", () => { · 10 unmodified lines | ||
| 29 | 29 | when: "terminalOpen && !terminalFocus", |
| 30 | 30 | }); |
| 31 | 31 | |
| 32 | − expect(compiled).toEqual({ | |
| 32 | + assert.deepEqual(compiled, { | |
| 33 | 33 | key: "mod+d", |
| 34 | 34 | command: "terminal.split", |
| 35 | 35 | when: "terminalOpen && !terminalFocus", |
| @@ -53,19 +53,19 @@ describe("server keybindings", () => { · 17 unmodified lines | ||
| 53 | 53 | }); |
| 54 | 54 | |
| 55 | 55 | it("rejects invalid rules", () => { |
| 56 | − expect( | |
| 56 | + assert.isNull( | |
| 57 | 57 | compileResolvedKeybindingRule({ |
| 58 | 58 | key: "mod+shift+d+o", |
| 59 | 59 | command: "terminal.new", |
| 60 | 60 | }), |
| 61 | − ).toBeNull(); | |
| 61 | + ); | |
| 62 | 62 | |
| 63 | − expect( | |
| 63 | + assert.isNull( | |
| 64 | 64 | compileResolvedKeybindingRule({ |
| 65 | 65 | key: "mod+d", |
| 66 | 66 | command: "terminal.split", |
| 67 | 67 | when: "terminalFocus && (", |
| 68 | 68 | }), |
| 69 | − ).toBeNull(); | |
| 69 | + ); | |
| 70 | 70 | }); |
| 71 | 71 | }); |
| @@ -1,4 +1,4 @@ | ||
| 1 | −import { describe, expect, it } from "vitest"; | |
| 1 | +import { assert, describe, it } from "vitest"; | |
| 2 | 2 | |
| 3 | 3 | import { |
| 4 | 4 | keybindingRuleSchema, |
| @@ -13,16 +13,18 @@ describe("keybindings contracts", () => { · 8 unmodified lines | ||
| 13 | 13 | key: "mod+j", |
| 14 | 14 | command: "terminal.toggle", |
| 15 | 15 | }); |
| 16 | − expect(parsed.command).toBe("terminal.toggle"); | |
| 16 | + assert.strictEqual(parsed.command, "terminal.toggle"); | |
| 17 | 17 | }); |
| 18 | 18 | |
| 19 | 19 | it("rejects invalid command values", () => { |
| 20 | − expect(() => | |
| 21 | − keybindingRuleSchema.parse({ | |
| 22 | − key: "mod+j", | |
| 23 | − command: "invalid.command" as unknown as "terminal.toggle", | |
| 24 | − }), | |
| 25 | − ).toThrow(); | |
| 20 | + assert.throws(() => | |
| 21 | + keybindingRuleSchema.parse( | |
| 22 | + { | |
| 23 | + key: "mod+j", | |
| 24 | + command: "invalid.command" as unknown as "terminal.toggle", | |
| 25 | + }, | |
| 26 | + ), | |
| 27 | + ); | |
| 26 | 28 | }); |
| 27 | 29 | |
| 28 | 30 | it("parses keybindings array payload", () => { |
| @@ -30,7 +32,7 @@ describe("keybindings contracts", () => { · 1 unmodified line | ||
| 30 | 32 | { key: "mod+j", command: "terminal.toggle" }, |
| 31 | 33 | { key: "mod+d", command: "terminal.split", when: "terminalFocus" }, |
| 32 | 34 | ]); |
| 33 | − expect(parsed).toHaveLength(2); | |
| 35 | + assert.lengthOf(parsed, 2); | |
| 34 | 36 | }); |
| 35 | 37 | |
| 36 | 38 | it("parses resolved keybinding rules", () => { |
| @@ -55,7 +57,7 @@ describe("keybindings contracts", () => { · 18 unmodified lines | ||
| 55 | 57 | }, |
| 56 | 58 | }, |
| 57 | 59 | }); |
| 58 | − expect(parsed.shortcut.key).toBe("d"); | |
| 60 | + assert.strictEqual(parsed.shortcut.key, "d"); | |
| 59 | 61 | }); |
| 60 | 62 | |
| 61 | 63 | it("parses resolved keybindings arrays", () => { |
| @@ -73,6 +75,6 @@ describe("keybindings contracts", () => { · 11 unmodified lines | ||
| 73 | 75 | }, |
| 74 | 76 | }, |
| 75 | 77 | ]); |
| 76 | − expect(parsed).toHaveLength(1); | |
| 78 | + assert.lengthOf(parsed, 1); | |
| 77 | 79 | }); |
| 78 | 80 | }); |