@@ -73,6 +73,19 @@ describe('frc_road_classes', () => {
7373 test ( 'missing class returns null' , ( ) => {
7474 expect ( featureFrcLevel ( { } ) ) . toBeNull ( ) ;
7575 } ) ;
76+
77+ test ( 'incident_class used as fallback when class is absent' , ( ) => {
78+ expect ( featureFrcLevel ( { 'incident_class' : 'motorway' } ) ) . toBe ( 0 ) ;
79+ expect ( featureFrcLevel ( { 'incident_class' : 'primary' } ) ) . toBe ( 2 ) ;
80+ } ) ;
81+
82+ test ( 'class takes precedence over incident_class' , ( ) => {
83+ expect ( featureFrcLevel ( { 'class' : 'motorway' , 'incident_class' : 'service' } ) ) . toBe ( 0 ) ;
84+ } ) ;
85+
86+ test ( 'unknown incident_class returns null' , ( ) => {
87+ expect ( featureFrcLevel ( { 'incident_class' : 'aeroway' } ) ) . toBeNull ( ) ;
88+ } ) ;
7689 } ) ;
7790
7891 describe ( 'isFeatureCoveredByFrcMask' , ( ) => {
@@ -101,6 +114,11 @@ describe('frc_road_classes', () => {
101114 expect ( isFeatureCoveredByFrcMask ( { class : 'primary' } , mask ) ) . toBe ( true ) ;
102115 expect ( isFeatureCoveredByFrcMask ( { class : 'secondary' } , mask ) ) . toBe ( false ) ;
103116 } ) ;
117+
118+ test ( 'incident_class fallback works in coverage check' , ( ) => {
119+ expect ( isFeatureCoveredByFrcMask ( { 'incident_class' : 'motorway' } , 0b1 ) ) . toBe ( true ) ;
120+ expect ( isFeatureCoveredByFrcMask ( { 'incident_class' : 'motorway' } , 0b10 ) ) . toBe ( false ) ;
121+ } ) ;
104122 } ) ;
105123
106124 describe ( 'matchesCoverageSourceLayer' , ( ) => {
0 commit comments