@@ -1162,7 +1162,34 @@ Root
11621162 XCTAssertNil ( availabilityDB. get ( type: String . self, forKey: " content " ) )
11631163 }
11641164
1165- func testNavigatorIndexDifferenHasherGeneration( ) throws {
1165+ func testCustomIconsInNavigator( ) throws {
1166+ let ( bundle, context) = try testBundleAndContext ( named: " BookLikeContent " ) // This content has a @PageImage with the "icon" purpose
1167+ let renderContext = RenderContext ( documentationContext: context, bundle: bundle)
1168+ let converter = DocumentationContextConverter ( bundle: bundle, context: context, renderContext: renderContext)
1169+
1170+ let targetURL = try createTemporaryDirectory ( )
1171+ let builder = NavigatorIndex . Builder ( outputURL: targetURL, bundleIdentifier: bundle. identifier, sortRootChildrenByName: true )
1172+ builder. setup ( )
1173+
1174+ for identifier in context. knownPages {
1175+ let source = context. documentURL ( for: identifier)
1176+ let entity = try context. entity ( with: identifier)
1177+ let renderNode = try XCTUnwrap ( converter. renderNode ( for: entity, at: source) )
1178+ try builder. index ( renderNode: renderNode)
1179+ }
1180+
1181+ builder. finalize ( )
1182+
1183+ let renderIndexData = try Data ( contentsOf: targetURL. appendingPathComponent ( " index.json " ) )
1184+ let renderIndex = try JSONDecoder ( ) . decode ( RenderIndex . self, from: renderIndexData)
1185+
1186+ let imageReference = try XCTUnwrap ( renderIndex. references [ " plus.svg " ] )
1187+ XCTAssertEqual ( imageReference. asset. variants. values. map ( \. path) . sorted ( ) , [
1188+ " /images/ \( bundle. identifier) /plus.svg " ,
1189+ ] )
1190+ }
1191+
1192+ func testNavigatorIndexDifferentHasherGeneration( ) throws {
11661193 let ( bundle, context) = try testBundleAndContext ( named: " TestBundle " )
11671194 let renderContext = RenderContext ( documentationContext: context, bundle: bundle)
11681195 let converter = DocumentationContextConverter ( bundle: bundle, context: context, renderContext: renderContext)
0 commit comments