@@ -283,6 +283,14 @@ describe('Definition generation', () => {
283283 expression = jsonata ( 'paths."/primitives/{id}".get.parameters[0].format' ) ;
284284 expect ( expression . evaluate ( spec ) ) . to . eq ( 'int64' ) ;
285285 } ) ;
286+
287+ it ( 'should generate array type names as type + Array' , ( ) => {
288+ let expression = jsonata ( 'definitions.ResponseBodystringArray' ) ;
289+ // tslint:disable-next-line:no-unused-expression
290+ expect ( expression . evaluate ( spec ) ) . to . not . be . undefined ;
291+ expression = jsonata ( 'paths."/primitives/array".get.responses."200".schema."$ref"' ) ;
292+ expect ( expression . evaluate ( spec ) ) . to . equal ( '#/definitions/ResponseBodystringArray' ) ;
293+ } ) ;
286294 } ) ;
287295
288296 describe ( 'ParameterizedEndpoint' , ( ) => {
@@ -303,4 +311,23 @@ describe('Definition generation', () => {
303311 expect ( expression . evaluate ( spec ) ) . to . eq ( 'A numeric identifier' ) ;
304312 } ) ;
305313 } ) ;
314+
315+ describe ( 'SecureEndpoint' , ( ) => {
316+ it ( 'should apply controller security to request' , ( ) => {
317+ const expression = jsonata ( 'paths."/secure".get.security' ) ;
318+ expect ( expression . evaluate ( spec ) ) . to . deep . equal ( [ { 'access_token' : [ ] } ] ) ;
319+ } ) ;
320+
321+ it ( 'method security should override controller security' , ( ) => {
322+ const expression = jsonata ( 'paths."/secure".post.security' ) ;
323+ expect ( expression . evaluate ( spec ) ) . to . deep . equal ( [ { 'user_email' : [ ] } ] ) ;
324+ } ) ;
325+ } ) ;
326+
327+ describe ( 'SuperSecureEndpoint' , ( ) => {
328+ it ( 'should apply two controller securities to request' , ( ) => {
329+ const expression = jsonata ( 'paths."/supersecure".get.security' ) ;
330+ expect ( expression . evaluate ( spec ) ) . to . deep . equal ( [ { 'access_token' : [ ] } , { 'user_email' : [ ] } ] ) ;
331+ } ) ;
332+ } ) ;
306333} ) ;
0 commit comments