@@ -156,6 +156,44 @@ describe("ComponentDetection.processComponentsToManifests", () => {
156156 expect ( manifests [ 0 ] . indirectDependencies ( ) ) . toHaveLength ( 1 ) ;
157157 expect ( manifests [ 0 ] . countDependencies ( ) ) . toBe ( 1 ) ;
158158 } ) ;
159+
160+ test ( "un-escapes URL-encoded locationsFoundAt" , ( ) => {
161+ const componentsFound = [
162+ {
163+ component : {
164+ name : "test-package" ,
165+ version : "1.0.0" ,
166+ packageUrl : {
167+ Scheme : "pkg" ,
168+ Type : "nuget" ,
169+ Name : "test-package" ,
170+ Version : "1.0.0"
171+ } ,
172+ id : "test-package 1.0.0 - nuget"
173+ } ,
174+ isDevelopmentDependency : false ,
175+ topLevelReferrers : [ ] , // Empty = direct dependency
176+ locationsFoundAt : [ "/my%20project/my%20project.csproj" ]
177+ }
178+ ] ;
179+
180+ const dependencyGraphs : DependencyGraphs = {
181+ "my project/my project.csproj" : {
182+ graph : { "test-package" : null } ,
183+ explicitlyReferencedComponentIds : [ "test-package 1.0.0 - nuget" ] ,
184+ developmentDependencies : [ ] ,
185+ dependencies : [ ]
186+ }
187+ } ;
188+
189+ const manifests = ComponentDetection . processComponentsToManifests ( componentsFound , dependencyGraphs ) ;
190+
191+ expect ( manifests ) . toHaveLength ( 1 ) ;
192+ expect ( manifests [ 0 ] . name ) . toBe ( "my project/my project.csproj" ) ;
193+ expect ( manifests [ 0 ] . directDependencies ( ) ) . toHaveLength ( 1 ) ;
194+ expect ( manifests [ 0 ] . indirectDependencies ( ) ) . toHaveLength ( 0 ) ;
195+ expect ( manifests [ 0 ] . countDependencies ( ) ) . toBe ( 1 ) ;
196+ } ) ;
159197} ) ;
160198
161199describe ( 'normalizeDependencyGraphPaths' , ( ) => {
0 commit comments