Generic user_bottom wiki block
This commit is contained in:
@@ -156,9 +156,9 @@ func TestMergeManagedContentPreservesUserTopAndBottomSections(t *testing.T) {
|
||||
`<p>User-written overview.</p>`,
|
||||
`<!-- sow-topdata-wiki:manual:end id="user_top" -->`,
|
||||
`<p>Old generated body.</p>`,
|
||||
`<!-- sow-topdata-wiki:manual:start id="notes" -->`,
|
||||
`<h2>Notes</h2><p>User note.</p>`,
|
||||
`<!-- sow-topdata-wiki:manual:end id="notes" -->`,
|
||||
`<!-- sow-topdata-wiki:manual:start id="user_bottom" -->`,
|
||||
`<p>User-written bottom content.</p>`,
|
||||
`<!-- sow-topdata-wiki:manual:end id="user_bottom" -->`,
|
||||
`<!-- sow-topdata-wiki:managed:end -->`,
|
||||
}, "\n")
|
||||
generated := strings.Join([]string{
|
||||
@@ -169,16 +169,16 @@ func TestMergeManagedContentPreservesUserTopAndBottomSections(t *testing.T) {
|
||||
`<p></p>`,
|
||||
`<!-- sow-topdata-wiki:manual:end id="user_top" -->`,
|
||||
`<p>New generated body.</p>`,
|
||||
`<!-- sow-topdata-wiki:manual:start id="notes" -->`,
|
||||
`<h2>Notes</h2><p></p>`,
|
||||
`<!-- sow-topdata-wiki:manual:end id="notes" -->`,
|
||||
`<!-- sow-topdata-wiki:manual:start id="user_bottom" -->`,
|
||||
`<p></p>`,
|
||||
`<!-- sow-topdata-wiki:manual:end id="user_bottom" -->`,
|
||||
`<!-- sow-topdata-wiki:managed:end -->`,
|
||||
}, "\n")
|
||||
|
||||
merged := mergeManagedContent(existing, generated)
|
||||
for _, expected := range []string{
|
||||
"<p>User-written overview.</p>",
|
||||
"<h2>Notes</h2><p>User note.</p>",
|
||||
"<p>User-written bottom content.</p>",
|
||||
"<p>New generated body.</p>",
|
||||
} {
|
||||
if !strings.Contains(merged, expected) {
|
||||
@@ -393,10 +393,9 @@ func TestDeployWikiAdoptsExistingNodeBBPageWhenManifestIsMissingWithoutCreate(t
|
||||
<h1>Acolyte</h1>
|
||||
<p>Generated acolyte page</p>
|
||||
<!-- sow-topdata-wiki:managed:end -->
|
||||
<!-- sow-topdata-wiki:manual:start id="notes" -->
|
||||
<h2>Notes</h2>
|
||||
<!-- sow-topdata-wiki:manual:start id="user_bottom" -->
|
||||
<p></p>
|
||||
<!-- sow-topdata-wiki:manual:end id="notes" -->
|
||||
<!-- sow-topdata-wiki:manual:end id="user_bottom" -->
|
||||
`
|
||||
if err := os.WriteFile(filepath.Join(sourceDir, "classes", "acolyte.html"), []byte(generated), 0644); err != nil {
|
||||
t.Fatalf("write source page: %v", err)
|
||||
@@ -406,10 +405,9 @@ func TestDeployWikiAdoptsExistingNodeBBPageWhenManifestIsMissingWithoutCreate(t
|
||||
<h1>Acolyte</h1>
|
||||
<p>Old acolyte page</p>
|
||||
<!-- sow-topdata-wiki:managed:end -->
|
||||
<!-- sow-topdata-wiki:manual:start id="notes" -->
|
||||
<h2>Notes</h2>
|
||||
<!-- sow-topdata-wiki:manual:start id="user_bottom" -->
|
||||
<p>Keep this remote note.</p>
|
||||
<!-- sow-topdata-wiki:manual:end id="notes" -->
|
||||
<!-- sow-topdata-wiki:manual:end id="user_bottom" -->
|
||||
`
|
||||
|
||||
createCalls := 0
|
||||
@@ -500,14 +498,9 @@ func TestDeployWikiMergesHTMLManagedAndManualRegions(t *testing.T) {
|
||||
<h1>Athletics</h1>
|
||||
<p>Generated athletics page</p>
|
||||
<!-- sow-topdata-wiki:managed:end -->
|
||||
<!-- sow-topdata-wiki:manual:start id="notes" -->
|
||||
<h2>Notes</h2>
|
||||
<!-- sow-topdata-wiki:manual:start id="user_bottom" -->
|
||||
<p></p>
|
||||
<!-- sow-topdata-wiki:manual:end id="notes" -->
|
||||
<!-- sow-topdata-wiki:manual:start id="see_also" -->
|
||||
<h2>See Also</h2>
|
||||
<p></p>
|
||||
<!-- sow-topdata-wiki:manual:end id="see_also" -->
|
||||
<!-- sow-topdata-wiki:manual:end id="user_bottom" -->
|
||||
`
|
||||
if err := os.WriteFile(filepath.Join(sourceDir, "skills", "athletics.html"), []byte(generated), 0644); err != nil {
|
||||
t.Fatalf("write source page: %v", err)
|
||||
@@ -517,10 +510,9 @@ func TestDeployWikiMergesHTMLManagedAndManualRegions(t *testing.T) {
|
||||
<h1>Athletics</h1>
|
||||
<p>Old generated text</p>
|
||||
<!-- sow-topdata-wiki:managed:end -->
|
||||
<!-- sow-topdata-wiki:manual:start id="notes" -->
|
||||
<h2>Notes</h2>
|
||||
<!-- sow-topdata-wiki:manual:start id="user_bottom" -->
|
||||
<p>Keep this human note.</p>
|
||||
<!-- sow-topdata-wiki:manual:end id="notes" -->
|
||||
<!-- sow-topdata-wiki:manual:end id="user_bottom" -->
|
||||
`
|
||||
manifestPath := filepath.Join(root, "deploy-manifest.json")
|
||||
if err := saveDeployManifest(manifestPath, wikiDeployManifest{
|
||||
@@ -572,9 +564,12 @@ func TestDeployWikiMergesHTMLManagedAndManualRegions(t *testing.T) {
|
||||
if result.Updated != 1 {
|
||||
t.Fatalf("expected one update, got %#v", result)
|
||||
}
|
||||
if !containsAll(updated, "<p>Generated athletics page</p>", "<p>Keep this human note.</p>", `manual:start id="see_also"`) {
|
||||
if !containsAll(updated, "<p>Generated athletics page</p>", "<p>Keep this human note.</p>", `manual:start id="user_bottom"`) {
|
||||
t.Fatalf("expected update to replace managed HTML and preserve/bootstrap manual regions:\n%s", updated)
|
||||
}
|
||||
if strings.Contains(updated, `manual:start id="notes"`) || strings.Contains(updated, `manual:start id="see_also"`) {
|
||||
t.Fatalf("expected update to omit legacy split bottom manual regions:\n%s", updated)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeployWikiUpdateAcquiresWestgateWikiEditLock(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user