@@ -27,6 +27,7 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'
2727import { provideTranslateHttpLoader , TRANSLATE_HTTP_LOADER_CONFIG } from '@ngx-translate/http-loader'
2828
2929describe ( 'ProfileDetailComponent' , ( ) => {
30+ const defaultCloudMode = environment . cloud
3031 let component : ProfileDetailComponent
3132 let fixture : ComponentFixture < ProfileDetailComponent >
3233 let profileSpy : jasmine . Spy
@@ -148,6 +149,7 @@ describe('ProfileDetailComponent', () => {
148149 } )
149150
150151 afterEach ( ( ) => {
152+ environment . cloud = defaultCloudMode
151153 TestBed . resetTestingModule ( )
152154 } )
153155
@@ -174,6 +176,7 @@ describe('ProfileDetailComponent', () => {
174176 expect ( wirelessGetDataSpy ) . toHaveBeenCalled ( )
175177 expect ( proxyGetDataSpy ) . toHaveBeenCalled ( )
176178 } )
179+
177180 it ( 'should set connectionMode to TLS when tlsMode is a TLS mode (1-4)' , ( ) => {
178181 const profile : Profile = { tlsMode : 4 , ciraConfigName : 'config1' } as any
179182 component . setConnectionMode ( profile )
@@ -835,9 +838,11 @@ describe('ProfileDetailComponent', () => {
835838 // server-features branch instead of the cloud branch.
836839 const createEnterpriseComponent = ( ) : ProfileDetailComponent => {
837840 environment . cloud = false
838- const enterpriseFixture = TestBed . createComponent ( ProfileDetailComponent )
839- enterpriseFixture . detectChanges ( )
840- return enterpriseFixture . componentInstance
841+ fixture . destroy ( )
842+ fixture = TestBed . createComponent ( ProfileDetailComponent )
843+ component = fixture . componentInstance
844+ fixture . detectChanges ( )
845+ return component
841846 }
842847
843848 afterEach ( ( ) => {
@@ -848,10 +853,12 @@ describe('ProfileDetailComponent', () => {
848853 serverFeaturesGetFeaturesSpy . and . returnValue ( of ( { ciraEnabled : false } ) )
849854 ciraGetDataSpy . calls . reset ( )
850855
851- createEnterpriseComponent ( )
856+ const enterpriseComponent = createEnterpriseComponent ( )
852857
853858 expect ( serverFeaturesGetFeaturesSpy ) . toHaveBeenCalled ( )
854859 expect ( ciraGetDataSpy ) . not . toHaveBeenCalled ( )
860+ expect ( enterpriseComponent . ciraEnabled ( ) ) . toBeFalse ( )
861+ expect ( fixture . nativeElement . querySelector ( '[data-cy="radio-cira"]' ) ) . toBeNull ( )
855862 } )
856863
857864 it ( 'should expose ciraEnabled() === false after the features call resolves with CIRA disabled' , ( ) => {
@@ -870,6 +877,7 @@ describe('ProfileDetailComponent', () => {
870877
871878 expect ( ciraGetDataSpy ) . toHaveBeenCalled ( )
872879 expect ( enterpriseComponent . ciraEnabled ( ) ) . toBeTrue ( )
880+ expect ( fixture . nativeElement . querySelector ( '[data-cy="radio-cira"]' ) ) . not . toBeNull ( )
873881 } )
874882
875883 it ( 'should fail open and fetch CIRA configs when the features call errors' , ( ) => {
@@ -880,6 +888,7 @@ describe('ProfileDetailComponent', () => {
880888
881889 expect ( ciraGetDataSpy ) . toHaveBeenCalled ( )
882890 expect ( enterpriseComponent . ciraEnabled ( ) ) . toBeTrue ( )
891+ expect ( fixture . nativeElement . querySelector ( '[data-cy="radio-cira"]' ) ) . not . toBeNull ( )
883892 } )
884893 } )
885894
0 commit comments