@@ -659,7 +659,50 @@ class MergeActionTests: XCTestCase {
659
659
" doc://org.swift.test/documentation/second.json " ,
660
660
] )
661
661
}
662
-
662
+
663
+ func testSingleReferenceOnlyArchiveMerging( ) async throws {
664
+ let fileSystem = try TestFileSystem (
665
+ folders: [
666
+ Folder ( name: " Output.doccarchive " , content: [ ] ) ,
667
+ Self . makeArchive (
668
+ name: " First " ,
669
+ documentationPages: [
670
+ " First " ,
671
+ " First/SomeClass " ,
672
+ " First/SomeClass/someProperty " ,
673
+ " First/SomeClass/someFunction(:_) " ,
674
+ ] ,
675
+ tutorialPages: [ ]
676
+ ) ,
677
+ ]
678
+ )
679
+
680
+ let logStorage = LogHandle . LogStorage ( )
681
+ let action = MergeAction (
682
+ archives: [
683
+ URL ( fileURLWithPath: " /First.doccarchive " ) ,
684
+ ] ,
685
+ landingPageInfo: testLandingPageInfo,
686
+ outputURL: URL ( fileURLWithPath: " /Output.doccarchive " ) ,
687
+ fileManager: fileSystem
688
+ )
689
+
690
+ _ = try await action. perform ( logHandle: . memory( logStorage) )
691
+ XCTAssertEqual ( logStorage. text, " " , " The action didn't log anything " )
692
+
693
+ let synthesizedRootNode = try fileSystem. renderNode ( atPath: " /Output.doccarchive/data/documentation.json " )
694
+ XCTAssertEqual ( synthesizedRootNode. metadata. title, " Test Landing Page Name " )
695
+ XCTAssertEqual ( synthesizedRootNode. metadata. roleHeading, " Test Landing Page Kind " )
696
+ XCTAssertEqual ( synthesizedRootNode. topicSectionsStyle, . detailedGrid)
697
+ XCTAssertEqual ( synthesizedRootNode. topicSections. flatMap { [ $0 . title ] . compactMap ( { $0 } ) + $0. identifiers } , [
698
+ // No title
699
+ " doc://org.swift.test/documentation/first.json " ,
700
+ ] )
701
+ XCTAssertEqual ( synthesizedRootNode. references. keys. sorted ( ) , [
702
+ " doc://org.swift.test/documentation/first.json " ,
703
+ ] )
704
+ }
705
+
663
706
func testErrorWhenArchivesContainOverlappingData( ) async throws {
664
707
let fileSystem = try TestFileSystem (
665
708
folders: [
@@ -953,14 +996,13 @@ class MergeActionTests: XCTestCase {
953
996
Output.doccarchive/
954
997
├─ data/
955
998
│ ├─ documentation.json
956
- │ ├─ documentation/
957
- │ │ ├─ first.json
958
- │ │ ├─ first/
959
- │ │ │ ╰─ article.json
960
- │ │ ├─ second.json
961
- │ │ ╰─ second/
962
- │ │ ╰─ article.json
963
- │ ╰─ tutorials/
999
+ │ ╰─ documentation/
1000
+ │ ├─ first.json
1001
+ │ ├─ first/
1002
+ │ │ ╰─ article.json
1003
+ │ ├─ second.json
1004
+ │ ╰─ second/
1005
+ │ ╰─ article.json
964
1006
├─ downloads/
965
1007
│ ├─ First/
966
1008
│ ╰─ Second/
0 commit comments