@@ -2239,7 +2239,21 @@ const runSpaceUpdatesWithNesting = () => {
22392239 } ,
22402240 } ;
22412241
2242- unitTest ( suiteLabel ( "one_nested_file_update" ) , async ( ) => {
2242+ const fakeMultiNestedFileWin : SiteFileMetadata = {
2243+ fileName :
2244+ "fake-great-grand-parent\\fake-grand-parent\\fake-parent\\fake-file-name.xml" ,
2245+ title : "fake-title" ,
2246+ originalTitle : "fake-title-original" ,
2247+ matchingPages : [ ] ,
2248+ contentBody : {
2249+ storage : {
2250+ value : "fake-value" ,
2251+ representation : "storage" ,
2252+ } ,
2253+ } ,
2254+ } ;
2255+
2256+ test ( suiteLabel ( "one_nested_file_update" ) , async ( ) => {
22432257 const fileMetadataList : SiteFileMetadata [ ] = [ fakeNestedFile ] ;
22442258
22452259 const existingSite = [
@@ -2292,7 +2306,7 @@ const runSpaceUpdatesWithNesting = () => {
22922306 assertEquals ( expected , actual ) ;
22932307 } ) ;
22942308
2295- unitTest ( suiteLabel ( "one_multi-nested_file_update" ) , async ( ) => {
2309+ test ( suiteLabel ( "one_multi-nested_file_update" ) , async ( ) => {
22962310 const fileMetadataList : SiteFileMetadata [ ] = [ fakeMultiNestedFile ] ;
22972311
22982312 const existingSite = [
@@ -2376,7 +2390,91 @@ const runSpaceUpdatesWithNesting = () => {
23762390 assertEquals ( expected , actual ) ;
23772391 } ) ;
23782392
2379- unitTest ( suiteLabel ( "two_nested_files_same_parent" ) , async ( ) => {
2393+ otest ( suiteLabel ( "one_multi-nested_file_update_win" ) , async ( ) => {
2394+ const fileMetadataList : SiteFileMetadata [ ] = [ fakeMultiNestedFileWin ] ;
2395+
2396+ const existingSite = [
2397+ {
2398+ id : "123456" ,
2399+ title : "fake-title" ,
2400+ metadata : {
2401+ fileName :
2402+ "fake-great-grand-parent/fake-grand-parent/fake-parent/fake-file-name.xml" ,
2403+ } ,
2404+ ancestors : [
2405+ { id : "fake-parent-id" } ,
2406+ { id : "fake-grand-parent-id" } ,
2407+ { id : "fake-great-grand-parent-id" } ,
2408+ ] ,
2409+ } ,
2410+ {
2411+ title : "Fake Parent" ,
2412+ id : "fake-parent-id" ,
2413+ metadata : {
2414+ editor : "v2" ,
2415+ fileName : "fake-great-grand-parent/fake-grand-parent/fake-parent" ,
2416+ } ,
2417+ ancestors : [
2418+ { id : "fake-grand-parent-id" } ,
2419+ { id : "fake-great-grand-parent-id" } ,
2420+ ] ,
2421+ } ,
2422+ {
2423+ title : "Fake Grand Parent" ,
2424+ id : "fake-grand-parent-id" ,
2425+ metadata : {
2426+ editor : "v2" ,
2427+ fileName : "fake-great-grand-parent/fake-grand-parent" ,
2428+ } ,
2429+ ancestors : [ { id : "fake-great-grand-parent-id" } ] ,
2430+ } ,
2431+ {
2432+ title : "Fake Great Grand Parent" ,
2433+ id : "fake-great-grand-parent-id" ,
2434+ metadata : { editor : "v2" , fileName : "fake-great-grand-parent" } ,
2435+ ancestors : [ { id : "fake-great-grand-parent-id" } ] ,
2436+ } ,
2437+ ] ;
2438+
2439+ const expected : ConfluenceSpaceChange [ ] = [
2440+ {
2441+ contentChangeType : ContentChangeType . update ,
2442+ ancestors : [
2443+ {
2444+ id : "fake-parent-id" ,
2445+ } ,
2446+ ] ,
2447+ body : {
2448+ storage : {
2449+ representation : "storage" ,
2450+ value : "fake-value" ,
2451+ } ,
2452+ } ,
2453+ fileName :
2454+ "fake-great-grand-parent/fake-grand-parent/fake-parent/fake-file-name.xml" ,
2455+ status : "current" ,
2456+ title : "fake-title" ,
2457+ type : "page" ,
2458+ id : "123456" ,
2459+ version : null ,
2460+ } ,
2461+ ] ;
2462+
2463+ const pagesToDelete = findPagesToDelete ( fileMetadataList , existingSite ) ;
2464+
2465+ assertEquals ( pagesToDelete , [ ] ) ;
2466+
2467+ const actual : ConfluenceSpaceChange [ ] = buildSpaceChanges (
2468+ fileMetadataList ,
2469+ FAKE_PARENT ,
2470+ fakeSpace ,
2471+ existingSite
2472+ ) ;
2473+
2474+ assertEquals ( expected , actual ) ;
2475+ } ) ;
2476+
2477+ test ( suiteLabel ( "two_nested_files_same_parent" ) , async ( ) => {
23802478 const fileMetadataList : SiteFileMetadata [ ] = [
23812479 fakeNestedFile ,
23822480 fakeNestedFile2 ,
@@ -2453,7 +2551,7 @@ const runSpaceUpdatesWithNesting = () => {
24532551 assertEquals ( expected , actual ) ;
24542552 } ) ;
24552553
2456- unitTest ( suiteLabel ( "three_nested_files_same_different_parent" ) , async ( ) => {
2554+ test ( suiteLabel ( "three_nested_files_same_different_parent" ) , async ( ) => {
24572555 const fileMetadataList : SiteFileMetadata [ ] = [
24582556 fakeNestedFile ,
24592557 fakeNestedFile2 ,
@@ -3503,6 +3601,15 @@ const runFindAttachments = () => {
35033601 check ( expected , bodyValue , filePaths , path ) ;
35043602 } ) ;
35053603
3604+ test ( suiteLabel ( "single_image_lookup_relative_path_win2" ) , async ( ) => {
3605+ const bodyValue : string =
3606+ '<ri:attachment ri:filename="images/elephant.png" ri:version-at-save="1" />' ;
3607+ const filePaths : string [ ] = [ "folder\\images\\elephant.png" ] ;
3608+ const path = "folder/index.xml" ;
3609+ const expected : string [ ] = [ "folder\\images\\elephant.png" ] ;
3610+ check ( expected , bodyValue , filePaths , path ) ;
3611+ } ) ;
3612+
35063613 test ( suiteLabel ( "single_image_lookup_dupe_name" ) , async ( ) => {
35073614 const bodyValue : string =
35083615 '<ri:attachment ri:filename="elephant.png" ri:version-at-save="1" />' ;
@@ -3651,39 +3758,5 @@ if (RUN_ALL_TESTS) {
36513758 runUpdateImagePathsForContentBody ( ) ;
36523759 runCapFirstLetter ( ) ;
36533760} else {
3654- runSpaceCreatesWithNesting ( ) ;
3761+ runSpaceUpdatesWithNesting ( ) ;
36553762}
3656-
3657- // WINDOWS
3658- // publishFiles: {
3659- // baseDir: "C:\\Users\\Megaport\\Documents\\dev\\quarto-confluence-test-main\\simple-site2\\_site",
3660- // rootFile: "index.html",
3661- // files: [
3662- // "folder\\images\\elephant.png",
3663- // "folder\\index.xml",
3664- // "images\\elephant.png",
3665- // "index.html",
3666- // "index.xml",
3667- // "search.json",
3668- // "site_libs\\bootstrap\\bootstrap-icons.css",
3669- // "site_libs\\bootstrap\\bootstrap-icons.woff",
3670- // "site_libs\\bootstrap\\bootstrap.min.css",
3671- // "site_libs\\bootstrap\\bootstrap.min.js",
3672- // "site_libs\\clipboard\\clipboard.min.js",
3673- // "site_libs\\quarto-html\\anchor.min.js",
3674- // "site_libs\\quarto-html\\popper.min.js",
3675- // "site_libs\\quarto-html\\quarto-syntax-highlighting.css",
3676- // "site_libs\\quarto-html\\quarto.js",
3677- // "site_libs\\quarto-html\\tippy.css",
3678- // "site_libs\\quarto-html\\tippy.umd.min.js",
3679- // "site_libs\\quarto-nav\\headroom.min.js",
3680- // "site_libs\\quarto-nav\\quarto-nav.js",
3681- // "site_libs\\quarto-search\\autocomplete.umd.js",
3682- // "site_libs\\quarto-search\\fuse.min.js",
3683- // "site_libs\\quarto-search\\quarto-search.js"
3684- // ],
3685- // metadataByInput: {
3686- // "folder\\index.qmd": { title: "Page 2", author: undefined, date: undefined },
3687- // "index.qmd": { title: "Page 1", author: undefined, date: undefined }
3688- // }
3689- // },
0 commit comments