@@ -23,28 +23,35 @@ describe('compas-settings', () => {
23
23
it ( 'stores settings to localStorage' , ( ) => {
24
24
CompasSettings ( ) . setCompasSetting ( 'sclDataServiceUrl' , 'http://localhost:9090/compas-scl-data-service' ) ;
25
25
CompasSettings ( ) . setCompasSetting ( 'cimMappingServiceUrl' , 'http://localhost:9091/compas-cim-mapping' ) ;
26
+ CompasSettings ( ) . setCompasSetting ( 'keycloakAuthUrl' , 'http://localhost:8089/auth/' ) ;
26
27
expect ( localStorage . getItem ( 'sclDataServiceUrl' ) ) . to . equal ( 'http://localhost:9090/compas-scl-data-service' ) ;
27
28
expect ( localStorage . getItem ( 'cimMappingServiceUrl' ) ) . to . equal ( 'http://localhost:9091/compas-cim-mapping' ) ;
29
+ expect ( localStorage . getItem ( 'keycloakAuthUrl' ) ) . to . equal ( 'http://localhost:8089/auth/' ) ;
28
30
} ) ;
29
31
30
32
it ( 'retrieves settings from localStorage' , ( ) => {
31
33
localStorage . setItem ( 'sclDataServiceUrl' , 'http://localhost:9090/compas-scl-data-service' ) ;
32
34
localStorage . setItem ( 'cimMappingServiceUrl' , 'http://localhost:9091/compas-cim-mapping' ) ;
35
+ localStorage . setItem ( 'keycloakAuthUrl' , 'http://localhost:8089/auth/' ) ;
33
36
expect ( CompasSettings ( ) . compasSettings ) . to . have . property ( 'sclDataServiceUrl' , 'http://localhost:9090/compas-scl-data-service' ) ;
34
37
expect ( CompasSettings ( ) . compasSettings ) . to . have . property ( 'cimMappingServiceUrl' , 'http://localhost:9091/compas-cim-mapping' ) ;
38
+ expect ( CompasSettings ( ) . compasSettings ) . to . have . property ( 'keycloakAuthUrl' , 'http://localhost:8089/auth/' ) ;
35
39
} ) ;
36
40
37
41
it ( 'saves chosen settings on save button click' , async ( ) => {
38
42
await element . updateComplete ;
39
43
40
44
element . getSclDataServiceUrlField ( ) . value = 'http://localhost:9091/compas-scl-data-service' ;
41
45
element . getCimMappingServiceUrlField ( ) . value = 'http://localhost:9092/compas-cim-mapping' ;
46
+ element . getKeycloakAuthUrlField ( ) . value = 'http://localhost:9089/auth/' ;
42
47
await element . getSclDataServiceUrlField ( ) . updateComplete ;
43
48
await element . getCimMappingServiceUrlField ( ) . updateComplete ;
49
+ await element . getKeycloakAuthUrlField ( ) . updateComplete ;
44
50
45
51
expect ( element . save ( ) ) . to . be . true ;
46
52
expect ( element . compasSettings ) . to . have . property ( 'sclDataServiceUrl' , 'http://localhost:9091/compas-scl-data-service' ) ;
47
53
expect ( element . compasSettings ) . to . have . property ( 'cimMappingServiceUrl' , 'http://localhost:9092/compas-cim-mapping' ) ;
54
+ expect ( element . compasSettings ) . to . have . property ( 'keycloakAuthUrl' , 'http://localhost:9089/auth/' ) ;
48
55
} ) ;
49
56
50
57
it ( 'save will not be done when invalid value (Scl Data Service)' , async ( ) => {
@@ -65,10 +72,20 @@ describe('compas-settings', () => {
65
72
expect ( element ) . to . have . deep . property ( 'compasSettings' , defaults ) ;
66
73
} ) ;
67
74
75
+ it ( 'save will not be done when invalid value (Keycloak Auth URL)' , async ( ) => {
76
+ await element . updateComplete ;
77
+ element . getKeycloakAuthUrlField ( ) . value = '' ;
78
+ await element . getKeycloakAuthUrlField ( ) . updateComplete ;
79
+
80
+ expect ( element . save ( ) ) . to . be . false ;
81
+ expect ( element ) . to . have . deep . property ( 'compasSettings' , defaults ) ;
82
+ } ) ;
83
+
68
84
it ( 'resets settings to default on reset button click' , async ( ) => {
69
85
await element . updateComplete ;
70
86
CompasSettings ( ) . setCompasSetting ( 'sclDataServiceUrl' , 'http://localhost:9091/compas-scl-data-service' ) ;
71
87
CompasSettings ( ) . setCompasSetting ( 'cimMappingServiceUrl' , 'http://localhost:9092/compas-cim-mapping' ) ;
88
+ CompasSettings ( ) . setCompasSetting ( 'keycloakAuthUrl' , 'http://localhost:9089/auth/' ) ;
72
89
73
90
expect ( element ) . to . not . have . deep . property ( 'compasSettings' , defaults ) ;
74
91
expect ( element . reset ( ) ) . to . be . true ;
0 commit comments