@@ -587,7 +587,14 @@ describe('DevicesService', () => {
587587
588588 const req = httpMock . expectOne ( `${ mockEnvironment . mpsServer } /api/v1/amt/features/device1` )
589589 expect ( req . request . method ) . toBe ( 'POST' )
590- expect ( req . request . body ) . toEqual ( payload )
590+ expect ( req . request . body ) . toEqual ( {
591+ userConsent : 'none' ,
592+ enableKVM : true ,
593+ enableSOL : true ,
594+ enableIDER : true ,
595+ ocr : true ,
596+ platformEraseEnabled : true
597+ } )
591598 req . flush ( mockResponse )
592599 } )
593600
@@ -652,6 +659,56 @@ describe('DevicesService', () => {
652659 expect ( ( latest as any ) . status ) . toBeUndefined ( )
653660 } )
654661
662+ it ( 'keeps the cached rpe value when a stale GET response arrives after a save' , ( ) => {
663+ const seeded : AMTFeaturesResponse = {
664+ userConsent : 'none' ,
665+ optInState : 0 ,
666+ redirection : true ,
667+ kvmAvailable : true ,
668+ KVM : true ,
669+ SOL : false ,
670+ IDER : false ,
671+ ocr : false ,
672+ httpsBootSupported : true ,
673+ winREBootSupported : true ,
674+ localPBABootSupported : true ,
675+ rpe : true ,
676+ rpeSupported : true ,
677+ pbaBootFilesPath : [ ] ,
678+ winREBootFilesPath : { instanceID : '' , biosBootString : '' , bootString : '' }
679+ }
680+ const emitted : AMTFeaturesResponse [ ] = [ ]
681+ service . featuresChanges ( 'device1' ) . subscribe ( ( v ) => {
682+ if ( v ) emitted . push ( v )
683+ } )
684+ service . getAMTFeatures ( 'device1' ) . subscribe ( )
685+ httpMock . expectOne ( `${ mockEnvironment . mpsServer } /api/v1/amt/features/device1` ) . flush ( seeded )
686+
687+ service
688+ . setAmtFeatures ( 'device1' , {
689+ userConsent : 'all' ,
690+ enableKVM : true ,
691+ enableSOL : true ,
692+ enableIDER : true ,
693+ ocr : true ,
694+ rpe : false
695+ } )
696+ . subscribe ( )
697+ httpMock . expectOne ( `${ mockEnvironment . mpsServer } /api/v1/amt/features/device1` ) . flush ( { status : 'SUCCESS' } as any )
698+
699+ let latestGet : AMTFeaturesResponse | undefined
700+ service . getAMTFeatures ( 'device1' ) . subscribe ( ( r ) => {
701+ latestGet = r
702+ } )
703+ httpMock . expectOne ( `${ mockEnvironment . mpsServer } /api/v1/amt/features/device1` ) . flush ( {
704+ ...seeded ,
705+ rpe : true
706+ } )
707+
708+ expect ( emitted [ emitted . length - 1 ] . rpe ) . toBe ( false )
709+ expect ( latestGet ?. rpe ) . toBe ( false )
710+ } )
711+
655712 it ( 'derives redirection from the chosen features rather than keeping the stale cached value' , ( ) => {
656713 const seeded : AMTFeaturesResponse = {
657714 userConsent : 'none' ,
0 commit comments