Skip to content

Commit 8e428b3

Browse files
author
Al Manning
committed
debugging
1 parent 1d3392f commit 8e428b3

File tree

3 files changed

+47
-6
lines changed

3 files changed

+47
-6
lines changed

src/publish/confluence/confluence.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,13 +678,21 @@ async function publish(
678678

679679
changeList = flattenIndexes(changeList, metadataByFilename);
680680

681+
console.log("updateLinks");
682+
console.log("metadataByFilename", metadataByFilename);
683+
681684
const { pass1Changes, pass2Changes } = updateLinks(
682685
metadataByFilename,
683686
changeList,
684687
server,
685688
siteParent
686689
);
687690

691+
console.log("{ pass1Changes, pass2Changes }", {
692+
pass1Changes,
693+
pass2Changes,
694+
});
695+
688696
changeList = pass1Changes;
689697

690698
trace("changelist Pass 1", changeList);

tests/configure-test-env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ python_exists=$(command -v python)
1717
if [ -z $python_exists ]
1818
then
1919
python_exists=$(command -v python3)
20-
if [ -z python_exists]
20+
if [ -z python_exists]
2121
then
2222
echo "No python found in PATH - Check your PATH or install python add to PATH."
2323
fi

tests/unit/confluence.test.ts

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ import {
6161
Space,
6262
} from "../../src/publish/confluence/api/types.ts";
6363

64-
const RUN_ALL_TESTS = true;
65-
const FOCUS_TEST = false;
64+
const RUN_ALL_TESTS = false;
65+
const FOCUS_TEST = true;
6666
const HIDE_NOISE = true;
6767

6868
const xtest = (
@@ -3741,7 +3741,7 @@ const runUpdateLinks = () => {
37413741
fileName: "release-planning.xml",
37423742
};
37433743

3744-
const UPDATE_LINKS_INDEX: ContentUpdate = {
3744+
const UPDATE_LINK_TO_INDEX: ContentUpdate = {
37453745
contentChangeType: ContentChangeType.update,
37463746
id: "19890228",
37473747
version: null,
@@ -3758,6 +3758,23 @@ const runUpdateLinks = () => {
37583758
fileName: "release-planning.xml",
37593759
};
37603760

3761+
const UPDATE_LINK_FROM_INDEX: ContentUpdate = {
3762+
contentChangeType: ContentChangeType.update,
3763+
id: "fake-folder-id",
3764+
version: null,
3765+
title: "fake-folder-title",
3766+
type: "page",
3767+
status: "current",
3768+
ancestors: [{ id: "19759105" }],
3769+
body: {
3770+
storage: {
3771+
value: "<a href='triage.qmd'>triage</a>",
3772+
representation: "storage",
3773+
},
3774+
},
3775+
fileName: "release-planning.xml",
3776+
};
3777+
37613778
const UPDATE_LINKS_SPECIAL_CHAR: ContentUpdate = {
37623779
contentChangeType: ContentChangeType.update,
37633780
id: "19890228",
@@ -3918,10 +3935,10 @@ const runUpdateLinks = () => {
39183935
});
39193936

39203937
test(suiteLabel("one_update_link_index"), async () => {
3921-
const changes: ConfluenceSpaceChange[] = [UPDATE_LINKS_INDEX];
3938+
const changes: ConfluenceSpaceChange[] = [UPDATE_LINK_TO_INDEX];
39223939
const rootURL = "fake-server/wiki/spaces/QUARTOCONF/pages";
39233940
const expectedUpdate: ContentUpdate = {
3924-
...UPDATE_LINKS_INDEX,
3941+
...UPDATE_LINK_TO_INDEX,
39253942
body: {
39263943
storage: {
39273944
value: `<a href=\'fake-server/wiki/spaces/QUARTOCONF/pages/fake-folder-id'>team</a>`,
@@ -3933,6 +3950,22 @@ const runUpdateLinks = () => {
39333950
check(expected, changes, fileMetadataTable, "fake-server", FAKE_PARENT);
39343951
});
39353952

3953+
test(suiteLabel("one_update_link_from_index"), async () => {
3954+
const changes: ConfluenceSpaceChange[] = [UPDATE_LINK_FROM_INDEX];
3955+
const rootURL = "fake-server/wiki/spaces/QUARTOCONF/pages";
3956+
const expectedUpdate: ContentUpdate = {
3957+
...UPDATE_LINK_FROM_INDEX,
3958+
body: {
3959+
storage: {
3960+
value: `<a href=\'fake-server/wiki/spaces/QUARTOCONF/pages/19890180'>triage</a>`,
3961+
representation: "storage",
3962+
},
3963+
},
3964+
};
3965+
const expected: ConfluenceSpaceChange[] = [expectedUpdate];
3966+
check(expected, changes, fileMetadataTable, "fake-server", FAKE_PARENT);
3967+
});
3968+
39363969
test(suiteLabel("one_update_link_special_char"), async () => {
39373970
const changes: ConfluenceSpaceChange[] = [UPDATE_LINKS_SPECIAL_CHAR];
39383971
const rootURL = "fake-server/wiki/spaces/QUARTOCONF/pages";

0 commit comments

Comments
 (0)