Verify catalog and Audita compatibility offline
This commit is contained in:
@@ -81,3 +81,26 @@ func TestResolveHandlesInheritancePartialAndFailures(t *testing.T) {
|
||||
t.Fatal("missing file accepted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveImportsSiblingVocabularyFragments(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
for name, content := range map[string]string{
|
||||
"settings/coast.yml": "config:\n imports: [{path: ../fragments/places.yml}]\nsetting: {entries: [{id: coast, name: Coast, category: place}]}\n",
|
||||
"fragments/places.yml": "setting: {entries: [{id: harbor, name: Harbor, category: place}]}\n",
|
||||
} {
|
||||
path := filepath.Join(dir, name)
|
||||
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(path, []byte(content), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
docs, err := Resolve(Sources{SettingFile: filepath.Join(dir, "settings", "coast.yml")}, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(string(docs["setting"]), "Harbor") || !strings.Contains(string(docs["setting"]), "Coast") {
|
||||
t.Fatalf("setting: %s", docs["setting"])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user