summaryrefslogtreecommitdiff
path: root/internal/appconfig/custom_validation_more_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-15 08:07:51 +0300
committerPaul Buetow <paul@buetow.org>2025-09-15 08:07:51 +0300
commitdac90ba0e3036a15779da70e771c5cf2818c817f (patch)
treebd6ddb850a640b3fce79f5e65b27ce41b95e11a3 /internal/appconfig/custom_validation_more_test.go
parent828d1cc59ac22d10cd1298aac0488f868e2280db (diff)
release: v0.10.1v0.10.1
- Fix TUI 'p' hotkey: open editor for Custom prompt - Introduce ActionCustomPrompt to disambiguate from Custom actions submenu - Bump version to 0.10.1
Diffstat (limited to 'internal/appconfig/custom_validation_more_test.go')
-rw-r--r--internal/appconfig/custom_validation_more_test.go39
1 files changed, 19 insertions, 20 deletions
diff --git a/internal/appconfig/custom_validation_more_test.go b/internal/appconfig/custom_validation_more_test.go
index 05d0d1a..36212aa 100644
--- a/internal/appconfig/custom_validation_more_test.go
+++ b/internal/appconfig/custom_validation_more_test.go
@@ -1,16 +1,16 @@
package appconfig
import (
- "path/filepath"
- "strings"
- "testing"
+ "path/filepath"
+ "strings"
+ "testing"
)
func TestCustomActions_MissingFields(t *testing.T) {
- dir := t.TempDir()
- t.Setenv("XDG_CONFIG_HOME", dir)
- cfgPath := filepath.Join(dir, "hexai", "config.toml")
- writeFile(t, cfgPath, `
+ dir := t.TempDir()
+ t.Setenv("XDG_CONFIG_HOME", dir)
+ cfgPath := filepath.Join(dir, "hexai", "config.toml")
+ writeFile(t, cfgPath, `
[prompts.code_action]
[[prompts.code_action.custom]]
title = "No ID"
@@ -19,17 +19,17 @@ instruction = "x"
id = "no-title"
instruction = "x"
`)
- cfg := Load(newLogger())
- if err := cfg.Validate(); err == nil || (!strings.Contains(err.Error(), "missing required field id") && !strings.Contains(err.Error(), "missing required field title")) {
- t.Fatalf("expected missing field error, got %v", err)
- }
+ cfg := Load(newLogger())
+ if err := cfg.Validate(); err == nil || (!strings.Contains(err.Error(), "missing required field id") && !strings.Contains(err.Error(), "missing required field title")) {
+ t.Fatalf("expected missing field error, got %v", err)
+ }
}
func TestCustomActions_InvalidHotkeys(t *testing.T) {
- dir := t.TempDir()
- t.Setenv("XDG_CONFIG_HOME", dir)
- cfgPath := filepath.Join(dir, "hexai", "config.toml")
- writeFile(t, cfgPath, `
+ dir := t.TempDir()
+ t.Setenv("XDG_CONFIG_HOME", dir)
+ cfgPath := filepath.Join(dir, "hexai", "config.toml")
+ writeFile(t, cfgPath, `
[prompts.code_action]
[[prompts.code_action.custom]]
id = "a"
@@ -40,9 +40,8 @@ hotkey = "too"
[tmux]
custom_menu_hotkey = "ab"
`)
- cfg := Load(newLogger())
- if err := cfg.Validate(); err == nil || (!strings.Contains(err.Error(), "hotkey must be a single character") && !strings.Contains(err.Error(), "invalid tmux.custom_menu_hotkey")) {
- t.Fatalf("expected invalid hotkey error, got %v", err)
- }
+ cfg := Load(newLogger())
+ if err := cfg.Validate(); err == nil || (!strings.Contains(err.Error(), "hotkey must be a single character") && !strings.Contains(err.Error(), "invalid tmux.custom_menu_hotkey")) {
+ t.Fatalf("expected invalid hotkey error, got %v", err)
+ }
}
-