test(apply): cover symlinks, force, dry-run, merge, errors, state round-trip

This commit is contained in:
2026-05-23 11:55:01 +01:00
parent dd990cf25b
commit 5e35dc47fe
4 changed files with 541 additions and 4 deletions
+28
View File
@@ -33,3 +33,31 @@ func TestLoadMissingProfile(t *testing.T) {
_, err := Load("testdata/missing")
assert.Error(t, err)
}
func TestLoadMissingConfigYAML(t *testing.T) {
// testdata/missing_config has no config.yaml — only an empty profiles dir.
_, err := Load("testdata/missing_config")
require.Error(t, err)
assert.Contains(t, err.Error(), "config.yaml")
}
func TestLoadMalformedConfigYAML(t *testing.T) {
_, err := Load("testdata/malformed_config")
require.Error(t, err)
assert.Contains(t, err.Error(), "parse")
assert.Contains(t, err.Error(), "config.yaml")
}
func TestLoadMissingActiveProfile(t *testing.T) {
// config.yaml references "nonexistent" profile which has no file.
_, err := Load("testdata/missing_active_profile")
require.Error(t, err)
assert.Contains(t, err.Error(), "nonexistent")
}
func TestLoadProfileMissingName(t *testing.T) {
// profile YAML exists but has no 'name' field.
_, err := Load("testdata/profile_no_name")
require.Error(t, err)
assert.Contains(t, err.Error(), "profile")
assert.Contains(t, err.Error(), "name")
}