@@ -701,7 +701,7 @@ class RenderNodeTranslatorSymbolVariantsTests: XCTestCase {
701
701
)
702
702
}
703
703
704
- func testEncodesNilTopicsSectionsForVariantIfDefaultIsNonEmpty ( ) throws {
704
+ func testEncodesNilTopicsSectionsForArticleVariantIfDefaultIsNonEmpty ( ) throws {
705
705
try assertMultiVariantArticle (
706
706
configureArticle: { article in
707
707
article. automaticTaskGroups = [ ]
@@ -738,6 +738,26 @@ class RenderNodeTranslatorSymbolVariantsTests: XCTestCase {
738
738
)
739
739
}
740
740
741
+ func testEncodesNilTopicsSectionsForSymbolVariantIfDefaultIsNonEmpty( ) throws {
742
+ try assertMultiVariantSymbol (
743
+ assertOriginalRenderNode: { renderNode in
744
+ XCTAssertEqual ( renderNode. topicSections. count, 6 )
745
+ } ,
746
+ assertDataAfterApplyingVariant: { renderNodeData in
747
+ // See reasoning for the RenderNodeProxy type in the similar test above.
748
+
749
+ struct RenderNodeProxy : Codable {
750
+ var topicSections : [ TaskGroupRenderSection ] ?
751
+ }
752
+
753
+ XCTAssertNil (
754
+ try JSONDecoder ( ) . decode ( RenderNodeProxy . self, from: renderNodeData) . topicSections,
755
+ " Expected topicSections to be null in the JSON because the article has no Objective-C topics. "
756
+ )
757
+ }
758
+ )
759
+ }
760
+
741
761
func testArticleAutomaticTaskGroupsForArticleOnlyIncludeTopicsAvailableInTheArticleLanguage( ) throws {
742
762
func referenceWithPath( _ path: String ) -> ResolvedTopicReference {
743
763
ResolvedTopicReference (
@@ -848,7 +868,13 @@ class RenderNodeTranslatorSymbolVariantsTests: XCTestCase {
848
868
XCTAssertEqual ( renderNode. topicSections. count, 2 )
849
869
} ,
850
870
assertAfterApplyingVariant: { renderNode in
851
- XCTAssertEqual ( renderNode. topicSections. count, 2 )
871
+ XCTAssert (
872
+ renderNode. topicSections. isEmpty,
873
+ """
874
+ Expected no topics section for the Objective-C variant, because there are no Objective-C \
875
+ relationships.
876
+ """
877
+ )
852
878
}
853
879
)
854
880
}
@@ -1040,7 +1066,8 @@ class RenderNodeTranslatorSymbolVariantsTests: XCTestCase {
1040
1066
configureSymbol: ( Symbol ) throws -> ( ) = { _ in } ,
1041
1067
configureRenderNodeTranslator: ( inout RenderNodeTranslator ) -> ( ) = { _ in } ,
1042
1068
assertOriginalRenderNode: ( RenderNode ) throws -> ( ) ,
1043
- assertAfterApplyingVariant: ( RenderNode ) throws -> ( )
1069
+ assertAfterApplyingVariant: ( RenderNode ) throws -> ( ) = { _ in } ,
1070
+ assertDataAfterApplyingVariant: ( Data ) throws -> ( ) = { _ in }
1044
1071
) throws {
1045
1072
let ( _, bundle, context) = try testBundleAndContext ( copying: " TestBundle " )
1046
1073
@@ -1066,7 +1093,8 @@ class RenderNodeTranslatorSymbolVariantsTests: XCTestCase {
1066
1093
identifier: identifier,
1067
1094
configureRenderNodeTranslator: configureRenderNodeTranslator,
1068
1095
assertOriginalRenderNode: assertOriginalRenderNode,
1069
- assertAfterApplyingVariant: assertAfterApplyingVariant
1096
+ assertAfterApplyingVariant: assertAfterApplyingVariant,
1097
+ assertDataAfterApplyingVariant: assertDataAfterApplyingVariant
1070
1098
)
1071
1099
}
1072
1100
0 commit comments