summaryrefslogtreecommitdiff
path: root/internal/appconfig
diff options
context:
space:
mode:
Diffstat (limited to 'internal/appconfig')
-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)
+ }
}
-