@@ -455,10 +455,46 @@ describe('IGExporter', () => {
455455 ] ) ;
456456 } ) ;
457457
458+ // See: https://chat.fhir.org/#narrow/channel/215610-shorthand/topic/ImplementationGuide.20URL.20missing/near/576162330
459+ it ( 'should fall back to release-agnostic IG when it cannot find a release-specific dependency implementation guide' , ( ) => {
460+ config . dependencies = [
461+ { packageId : 'hl7.fhir.eu.extensions.r4' , version : '1.2.0' } ,
462+ { packageId : 'hl7.fhir.us.core' , version : '3.1.0' }
463+ ] ;
464+ exporter . export ( tempOut ) ;
465+ const igPath = path . join (
466+ tempOut ,
467+ 'fsh-generated' ,
468+ 'resources' ,
469+ 'ImplementationGuide-sushi-test.json'
470+ ) ;
471+ expect ( fs . existsSync ( igPath ) ) . toBeTruthy ( ) ;
472+ const content = fs . readJSONSync ( igPath ) ;
473+ const dependencies : ImplementationGuideDependsOn [ ] = content . dependsOn ;
474+ expect ( loggerSpy . getAllLogs ( 'error' ) ) . toHaveLength ( 0 ) ;
475+ // ensure both packages are in the dependencies
476+ expect ( dependencies ) . toEqual ( [
477+ {
478+ id : 'hl7_fhir_eu_extensions_r4' ,
479+ uri : 'http://hl7.eu/fhir/extensions/ImplementationGuide/hl7.fhir.eu.extensions' ,
480+ packageId : 'hl7.fhir.eu.extensions.r4' ,
481+ version : '1.2.0'
482+ } ,
483+ {
484+ id : 'hl7_fhir_us_core' ,
485+ uri : 'http://hl7.org/fhir/us/core/ImplementationGuide/hl7.fhir.us.core' ,
486+ packageId : 'hl7.fhir.us.core' ,
487+ version : '3.1.0'
488+ }
489+ ] ) ;
490+ } ) ;
491+
458492 it ( 'should use a default url format when a dependency url cannot be inferred' , ( ) => {
459493 config . dependencies = [
460494 // NOTE: Will not find mCODE IG URL because we didn't load the mcode IG
461495 { packageId : 'hl7.fhir.us.mcode' , version : '1.0.0' } ,
496+ // NOTE: Test release-specific that isn't found to ensure fallback code doesn't trigger
497+ { packageId : 'hl7.fhir.us.something.r4' , version : '2.0.0' } ,
462498 { packageId : 'hl7.fhir.us.core' , version : '3.1.0' }
463499 ] ;
464500 exporter . export ( tempOut ) ;
@@ -480,6 +516,12 @@ describe('IGExporter', () => {
480516 packageId : 'hl7.fhir.us.mcode' ,
481517 version : '1.0.0'
482518 } ,
519+ {
520+ id : 'hl7_fhir_us_something_r4' ,
521+ uri : 'http://fhir.org/packages/hl7.fhir.us.something.r4/ImplementationGuide/hl7.fhir.us.something.r4' ,
522+ packageId : 'hl7.fhir.us.something.r4' ,
523+ version : '2.0.0'
524+ } ,
483525 {
484526 id : 'hl7_fhir_us_core' ,
485527 uri : 'http://hl7.org/fhir/us/core/ImplementationGuide/hl7.fhir.us.core' ,
0 commit comments