Wipe metadata
This commit is contained in:
@@ -316,6 +316,54 @@ func TestBuildNativeCanOmitAggregateWikiStatusListings(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildNativeCanDisableWikiStatusPages(t *testing.T) {
|
||||
root := testProjectRoot(t)
|
||||
mkdirAll(t, filepath.Join(root, "topdata", "data", "skills"))
|
||||
writeFile(t, filepath.Join(root, "topdata", "base_dialog.json"), "{}\n")
|
||||
writeFile(t, filepath.Join(root, "topdata", "data", "skills", "base.json"), `{
|
||||
"output": "skills.2da",
|
||||
"columns": ["Label", "Name", "Description", "HideFromLevelUp", "Untrained", "KeyAbility", "ArmorCheckPenalty", "Constant"],
|
||||
"rows": [
|
||||
{
|
||||
"id": 0,
|
||||
"key": "skills:athletics",
|
||||
"Label": "Athletics",
|
||||
"Name": {"tlk": {"key": "skills:athletics.name", "text": "Athletics"}},
|
||||
"Description": {"tlk": {"key": "skills:athletics.description", "text": "Ability: Strength."}},
|
||||
"HideFromLevelUp": "0",
|
||||
"Untrained": "1",
|
||||
"KeyAbility": "STR",
|
||||
"ArmorCheckPenalty": "1",
|
||||
"Constant": "SKILL_ATHLETICS"
|
||||
}
|
||||
]
|
||||
}`+"\n")
|
||||
writeFile(t, filepath.Join(root, "topdata", "data", "skills", "lock.json"), `{"skills:athletics":0}`+"\n")
|
||||
|
||||
disabled := false
|
||||
proj := testProject(root)
|
||||
proj.Config.TopData.ReferenceBuilder = ""
|
||||
proj.Config.TopData.Wiki.StatusPages = &disabled
|
||||
|
||||
result, err := BuildNative(proj, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("BuildNative failed: %v", err)
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(root, ".cache", "wiki", "pages", "meta")); !os.IsNotExist(err) {
|
||||
t.Fatalf("expected wiki status pages to be disabled, got err=%v", err)
|
||||
}
|
||||
indexRaw, err := os.ReadFile(filepath.Join(root, ".cache", "wiki", "page-index.json"))
|
||||
if err != nil {
|
||||
t.Fatalf("read page index: %v", err)
|
||||
}
|
||||
if strings.Contains(string(indexRaw), `"namespace": "meta"`) || strings.Contains(string(indexRaw), `"meta:wikistatus`) {
|
||||
t.Fatalf("expected disabled status pages to be omitted from page-index:\n%s", indexRaw)
|
||||
}
|
||||
if result.WikiPages != 1 {
|
||||
t.Fatalf("expected only entity page to be generated, got %d pages", result.WikiPages)
|
||||
}
|
||||
}
|
||||
|
||||
func countGeneratedWikiHTMLFiles(t *testing.T, root string) int {
|
||||
t.Helper()
|
||||
count := 0
|
||||
|
||||
Reference in New Issue
Block a user