| ... | ... | @@ -411,6 +411,28 @@ it.layer(NodeServices.layer)("keybindings", (it) => { |
| 411 | 411 | }).pipe(Effect.provide(makeKeybindingsLayer())), |
| 412 | 412 | ); |
| 413 | 413 | |
| 414 | it.effect("replacing with a rule that already exists elsewhere does not duplicate it", () => |
| 415 | Effect.gen(function* () { |
| 416 | const { keybindingsConfigPath } = yield* ServerConfig.ServerConfig; |
| 417 | yield* writeKeybindingsConfig(keybindingsConfigPath, [ |
| 418 | { key: "mod+r", command: "script.run-tests.run" }, |
| 419 | { key: "mod+alt+r", command: "script.run-tests.run" }, |
| 420 | ]); |
| 421 | yield* Effect.gen(function* () { |
| 422 | const keybindings = yield* Keybindings.Keybindings; |
| 423 | return yield* keybindings.upsertKeybindingRule({ |
| 424 | key: "mod+alt+r", |
| 425 | command: "script.run-tests.run", |
| 426 | replace: { key: "mod+r", command: "script.run-tests.run" }, |
| 427 | }); |
| 428 | }); |
| 429 | |
| 430 | const persisted = yield* readKeybindingsConfig(keybindingsConfigPath); |
| 431 | const persistedView = persisted.map(({ key, command }) => ({ key, command })); |
| 432 | assert.deepEqual(persistedView, [{ key: "mod+alt+r", command: "script.run-tests.run" }]); |
| 433 | }).pipe(Effect.provide(makeKeybindingsLayer())), |
| 434 | ); |
| 435 | |
| 414 | 436 | it.effect("removes only the targeted custom keybinding", () => |
| 415 | 437 | Effect.gen(function* () { |
| 416 | 438 | const { keybindingsConfigPath } = yield* ServerConfig.ServerConfig; |