File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
extensions/ql-vscode/test/unit-tests Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -720,6 +720,33 @@ describe("SARIF processing", () => {
720720 expectNoParsingError ( result ) ;
721721 expect ( actualCodeSnippet ) . not . toBeUndefined ( ) ;
722722 } ) ;
723+
724+ it ( "should be able to handle when a location has no uri" , ( ) => {
725+ const sarif = buildValidSarifLog ( ) ;
726+ sarif . runs ! [ 0 ] . results ! [ 0 ] . message . text = "message [String](1)" ;
727+ sarif . runs ! [ 0 ] . results ! [ 0 ] . relatedLocations = [
728+ {
729+ id : 1 ,
730+ physicalLocation : {
731+ artifactLocation : {
732+ uri : "file:/modules/java.base/java/lang/String.class" ,
733+ index : 1 ,
734+ } ,
735+ } ,
736+ message : {
737+ text : "String" ,
738+ } ,
739+ } ,
740+ ] ;
741+
742+ const result = extractAnalysisAlerts ( sarif , fakefileLinkPrefix ) ;
743+
744+ const actualCodeSnippet = result . alerts [ 0 ] . codeSnippet ;
745+
746+ expect ( result ) . toBeTruthy ( ) ;
747+ expectNoParsingError ( result ) ;
748+ expect ( actualCodeSnippet ) . not . toBeUndefined ( ) ;
749+ } ) ;
723750 } ) ;
724751
725752 function expectResultParsingError ( msg : string ) {
You can’t perform that action at this time.
0 commit comments