Opt-In Wiki Generation
This commit is contained in:
@@ -86,6 +86,56 @@ func TestBuildNativeGeneratesAndSkipsWikiPages(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildAndPackageBuildsWikiOnlyWhenRequested(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": "Skill text."}},
|
||||
"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")
|
||||
|
||||
proj := testProject(root)
|
||||
proj.Config.TopData.ReferenceBuilder = ""
|
||||
|
||||
result, err := BuildAndPackageWithOptions(proj, BuildAndPackageOptions{}, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("BuildAndPackageWithOptions failed: %v", err)
|
||||
}
|
||||
if result.WikiOutputDir != "" || result.WikiPages != 0 {
|
||||
t.Fatalf("expected wiki generation to be skipped by default, got dir=%q pages=%d", result.WikiOutputDir, result.WikiPages)
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(root, "topdata", ".wiki", "state.json")); !os.IsNotExist(err) {
|
||||
t.Fatalf("expected no wiki state without explicit wiki build, got %v", err)
|
||||
}
|
||||
|
||||
result, err = BuildAndPackageWithOptions(proj, BuildAndPackageOptions{Force: true, BuildWiki: true}, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("BuildAndPackageWithOptions with wiki failed: %v", err)
|
||||
}
|
||||
if result.WikiPages != 1 {
|
||||
t.Fatalf("expected one generated wiki page when requested, got %d", result.WikiPages)
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(root, "topdata", ".wiki", "state.json")); err != nil {
|
||||
t.Fatalf("expected wiki state after explicit wiki build: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildNativeRegeneratesWikiWhenTLKTextChanges(t *testing.T) {
|
||||
root := testProjectRoot(t)
|
||||
mkdirAll(t, filepath.Join(root, "topdata", "data", "skills"))
|
||||
|
||||
Reference in New Issue
Block a user