Aligns module path with canonical Gitea source (infra ADR-0004) and repo name. Binary only, no downstream consumers. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Roq1ajWKR5f1hG5Df9wC6A
54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
package config_test
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"git.d-ma.be/mathias/hyperguild/internal/config"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
const testYAML = `
|
|
default_chain:
|
|
- ollama/qwen3-coder-30b-tuned
|
|
- claude-sonnet-4-6
|
|
|
|
skills:
|
|
review:
|
|
chain:
|
|
- ollama/devstral-tuned
|
|
- ollama/gemma4
|
|
- claude-sonnet-4-6
|
|
spec:
|
|
chain:
|
|
- ollama/phi4
|
|
- claude-opus-4-6
|
|
`
|
|
|
|
func writeModels(t *testing.T, content string) string {
|
|
t.Helper()
|
|
f := filepath.Join(t.TempDir(), "models.yaml")
|
|
require.NoError(t, os.WriteFile(f, []byte(content), 0644))
|
|
return f
|
|
}
|
|
|
|
func TestModelsModelForSkillWithEntry(t *testing.T) {
|
|
m, err := config.LoadModels(writeModels(t, testYAML))
|
|
require.NoError(t, err)
|
|
assert.Equal(t, "ollama/devstral-tuned", m.ModelFor("review", ""))
|
|
}
|
|
|
|
func TestModelsModelForDefaultFallback(t *testing.T) {
|
|
m, err := config.LoadModels(writeModels(t, testYAML))
|
|
require.NoError(t, err)
|
|
assert.Equal(t, "ollama/qwen3-coder-30b-tuned", m.ModelFor("trainer", ""))
|
|
}
|
|
|
|
func TestModelsModelForCallerOverride(t *testing.T) {
|
|
m, err := config.LoadModels(writeModels(t, testYAML))
|
|
require.NoError(t, err)
|
|
assert.Equal(t, "claude-opus-4-6", m.ModelFor("review", "claude-opus-4-6"))
|
|
}
|