]> git.giacomolli.uk - onechat/blobdiff - config_test.go
Name and order the tool code
[onechat] / config_test.go
index ae84c96d6580ef57d474732eb7473078f4258756..92ff2e0b9e3551e6824bd5804118a8f03892a51b 100644 (file)
@@ -25,7 +25,7 @@ func TestLoadConfigKeepsDefaultsForMissingFields(t *testing.T) {
        require.Equal(t, Config{
                Endpoint: endpointAPI,
                Compactor: ModelConfig{
-                       Model:  "gpt-6-luna",
+                       Model:  "gpt-6.1-sol",
                        Effort: "xhigh",
                },
        }, config)
@@ -36,12 +36,30 @@ func TestLoadConfigRejectsInvalidFiles(t *testing.T) {
                name string
                text string
        }{
-               {"unknown field", `{"endpont": "api"}`},
-               {"unknown nested field", `{"compactor": {"modle": "x"}}`},
-               {"endpoint URL", `{"endpoint": "https://example.com/v1/responses"}`},
-               {"empty model", `{"compactor": {"model": ""}}`},
-               {"second object", `{} {}`},
-               {"broken JSON", `{"endpoint": `},
+               {
+                       name: "unknown field",
+                       text: `{"endpont": "api"}`,
+               },
+               {
+                       name: "unknown nested field",
+                       text: `{"compactor": {"modle": "x"}}`,
+               },
+               {
+                       name: "endpoint URL",
+                       text: `{"endpoint": "https://example.com/v1/responses"}`,
+               },
+               {
+                       name: "empty model",
+                       text: `{"compactor": {"model": ""}}`,
+               },
+               {
+                       name: "second object",
+                       text: `{} {}`,
+               },
+               {
+                       name: "broken JSON",
+                       text: `{"endpoint": `,
+               },
        }
 
        for _, tc := range testCases {
@@ -64,10 +82,34 @@ func TestDataDirFollowsTheOrder(t *testing.T) {
                home string
                want string
        }{
-               {"ONECHAT_DIR first", filepath.Join(root, "a"), filepath.Join(root, "xdg"), root, filepath.Join(root, "a")},
-               {"absolute XDG_DATA_HOME", "", filepath.Join(root, "xdg"), root, filepath.Join(root, "xdg", "onechat")},
-               {"relative XDG_DATA_HOME ignored", "", "xdg", root, filepath.Join(root, ".local", "share", "onechat")},
-               {"home directory last", "", "", root, filepath.Join(root, ".local", "share", "onechat")},
+               {
+                       name: "ONECHAT_DIR first",
+                       dir:  filepath.Join(root, "a"),
+                       xdg:  filepath.Join(root, "xdg"),
+                       home: root,
+                       want: filepath.Join(root, "a"),
+               },
+               {
+                       name: "absolute XDG_DATA_HOME",
+                       dir:  "",
+                       xdg:  filepath.Join(root, "xdg"),
+                       home: root,
+                       want: filepath.Join(root, "xdg", "onechat"),
+               },
+               {
+                       name: "relative XDG_DATA_HOME ignored",
+                       dir:  "",
+                       xdg:  "xdg",
+                       home: root,
+                       want: filepath.Join(root, ".local", "share", "onechat"),
+               },
+               {
+                       name: "home directory last",
+                       dir:  "",
+                       xdg:  "",
+                       home: root,
+                       want: filepath.Join(root, ".local", "share", "onechat"),
+               },
        }
 
        for _, tc := range testCases {