@@ -13,48 +13,51 @@ describe('Test API-Manager configuration variations', () => {
1313
1414 describe ( 'Test API-Manager parsing' , ( ) => {
1515 it ( 'should succeed with a single API-Manager configured' , async ( ) => {
16- debugger ;
17- var pluginConfig = {
16+ const pluginConfig = {
1817 apimanager : {
1918 url : "http://my.api-manager.com:8075" ,
2019 username : "user" , password : "password"
2120 }
2221 } ;
2322 var expectedManagers = {
23+ url : "http://my.api-manager.com:8075" , username : "user" , password : "password" ,
2424 "default" : {
2525 url : "http://my.api-manager.com:8075" ,
2626 username : "user" , password : "password"
2727 }
2828 }
29- var configuredManagers = await parseAPIManagerConfig ( pluginConfig , options ) ;
30- expect ( configuredManagers ) . to . deep . equal ( expectedManagers ) ;
29+ await parseAPIManagerConfig ( pluginConfig , options ) ;
30+ expect ( pluginConfig . apimanager ) . to . deep . equal ( expectedManagers ) ;
3131 } ) ;
3232
3333 it ( 'should succeed without giving an API-Manager' , async ( ) => {
34- var pluginConfig = {
34+ const pluginConfig = {
3535 apigateway : { url : "http://my.api-gateway.com:8090" } ,
3636 apimanager : {
3737 username : "user" , password : "password"
3838 }
3939 } ;
4040 var expectedManagers = {
41+ username : "user" , password : "password" ,
4142 "default" : {
4243 url : "http://my.api-gateway.com:8075/" ,
4344 username : "user" , password : "password"
4445 }
4546 }
46- var configuredManagers = await parseAPIManagerConfig ( pluginConfig , options ) ;
47- expect ( configuredManagers ) . to . deep . equal ( expectedManagers ) ;
47+ await parseAPIManagerConfig ( pluginConfig , options ) ;
48+ expect ( pluginConfig . apimanager ) . to . deep . equal ( expectedManagers ) ;
4849 } ) ;
4950
5051 it ( 'should succeed with a default plus group based API-Manager' , async ( ) => {
51- var pluginConfig = {
52+ const pluginConfig = {
5253 apimanager : {
5354 url : "http://my.api-manager.com:8075, group-a|http://my.group-a-api-manager.com:8075" ,
5455 username : "user" , password : "password"
5556 }
5657 } ;
5758 var expectedManagers = {
59+ url : "http://my.api-manager.com:8075, group-a|http://my.group-a-api-manager.com:8075" ,
60+ username : "user" , password : "password" ,
5861 "perGroupAndRegion" : true ,
5962 "default" : {
6063 url : "http://my.api-manager.com:8075" ,
@@ -65,18 +68,20 @@ describe('Test API-Manager configuration variations', () => {
6568 username : "user" , password : "password"
6669 }
6770 }
68- var configuredManagers = await parseAPIManagerConfig ( pluginConfig , options ) ;
69- expect ( configuredManagers ) . to . deep . equal ( expectedManagers ) ;
71+ await parseAPIManagerConfig ( pluginConfig , options ) ;
72+ expect ( pluginConfig . apimanager ) . to . deep . equal ( expectedManagers ) ;
7073 } ) ;
7174
7275 it ( 'should succeed with a default plus group plus region based API-Manager' , async ( ) => {
73- var pluginConfig = {
76+ const pluginConfig = {
7477 apimanager : {
7578 url : "http://my.api-manager.com:8075, group-a|http://my.group-a-api-manager.com:8075, group-b|US|http://my.group-b-us-api-manager.com:8075" ,
7679 username : "user" , password : "password"
7780 }
7881 } ;
7982 var expectedManagers = {
83+ url : "http://my.api-manager.com:8075, group-a|http://my.group-a-api-manager.com:8075, group-b|US|http://my.group-b-us-api-manager.com:8075" ,
84+ username : "user" , password : "password" ,
8085 "perGroupAndRegion" : true ,
8186 "default" : {
8287 url : "http://my.api-manager.com:8075" ,
@@ -91,18 +96,20 @@ describe('Test API-Manager configuration variations', () => {
9196 username : "user" , password : "password"
9297 }
9398 }
94- var configuredManagers = await parseAPIManagerConfig ( pluginConfig , options ) ;
95- expect ( configuredManagers ) . to . deep . equal ( expectedManagers ) ;
99+ await parseAPIManagerConfig ( pluginConfig , options ) ;
100+ expect ( pluginConfig . apimanager ) . to . deep . equal ( expectedManagers ) ;
96101 } ) ;
97102
98103 it ( 'should succeed without a default API-Manager only group based' , async ( ) => {
99- var pluginConfig = {
104+ const pluginConfig = {
100105 apimanager : {
101106 url : "group-a|http://my.group-a-api-manager.com:8075, group-b|US|http://my.group-b-us-api-manager.com:8075" ,
102107 username : "user" , password : "password"
103108 }
104109 } ;
105110 var expectedManagers = {
111+ url : "group-a|http://my.group-a-api-manager.com:8075, group-b|US|http://my.group-b-us-api-manager.com:8075" ,
112+ username : "user" , password : "password" ,
106113 "perGroupAndRegion" : true ,
107114 "group-a" : {
108115 url : "http://my.group-a-api-manager.com:8075" ,
@@ -113,8 +120,8 @@ describe('Test API-Manager configuration variations', () => {
113120 username : "user" , password : "password"
114121 }
115122 }
116- var configuredManagers = await parseAPIManagerConfig ( pluginConfig , options ) ;
117- expect ( configuredManagers ) . to . deep . equal ( expectedManagers ) ;
123+ await parseAPIManagerConfig ( pluginConfig , options ) ;
124+ expect ( pluginConfig . apimanager ) . to . deep . equal ( expectedManagers ) ;
118125 } ) ;
119126 } ) ;
120127
@@ -134,7 +141,7 @@ describe('Test API-Manager configuration variations', () => {
134141 }
135142 }
136143 var result = await checkAPIManagers ( configuredManagers , options ) ;
137- expect ( result ) . to . equal ( true ) ;
144+ expect ( result . isValid ) . to . equal ( true ) ;
138145 expect ( configuredManagers . default . isValid ) . to . equal ( true ) ;
139146 } ) ;
140147
@@ -152,7 +159,7 @@ describe('Test API-Manager configuration variations', () => {
152159 }
153160 }
154161 var result = await checkAPIManagers ( configuredManagers , options ) ;
155- expect ( result ) . to . equal ( false ) ;
162+ expect ( result . isValid ) . to . equal ( false ) ;
156163 expect ( configuredManagers . default . isValid ) . to . equal ( false ) ;
157164 } ) ;
158165
@@ -178,7 +185,7 @@ describe('Test API-Manager configuration variations', () => {
178185 } ,
179186 }
180187 var result = await checkAPIManagers ( configuredManagers , options ) ;
181- expect ( result ) . to . equal ( true ) ;
188+ expect ( result . isValid ) . to . equal ( true ) ;
182189 expect ( configuredManagers . default . isValid ) . to . equal ( true ) ;
183190 expect ( configuredManagers . default . isValid ) . to . equal ( true ) ;
184191 } ) ;
@@ -205,7 +212,7 @@ describe('Test API-Manager configuration variations', () => {
205212 } ,
206213 }
207214 var result = await checkAPIManagers ( configuredManagers , options ) ;
208- expect ( result ) . to . equal ( false ) ;
215+ expect ( result . isValid ) . to . equal ( false ) ;
209216 expect ( configuredManagers . default . isValid ) . to . equal ( true ) ;
210217 expect ( configuredManagers [ 'group-a' ] . isValid ) . to . equal ( false ) ;
211218 } ) ;
0 commit comments