@@ -8,36 +8,55 @@ describe('@RequestMapping', () => {
88 method : RequestMethod . ALL ,
99 } ;
1010
11+ const requestPropsUsingArray = {
12+ path : [ 'foo' , 'bar' ] ,
13+ method : RequestMethod . ALL ,
14+ } ;
15+
1116 it ( 'should enhance class with expected request metadata' , ( ) => {
1217 class Test {
1318 @RequestMapping ( requestProps )
14- public static test ( ) { }
19+ public static test ( ) { }
20+
21+ @RequestMapping ( requestPropsUsingArray )
22+ public static testUsingArray ( ) { }
1523 }
1624
1725 const path = Reflect . getMetadata ( 'path' , Test . test ) ;
1826 const method = Reflect . getMetadata ( 'method' , Test . test ) ;
27+ const pathUsingArray = Reflect . getMetadata ( 'path' , Test . testUsingArray ) ;
28+ const methodUsingArray = Reflect . getMetadata ( 'method' , Test . testUsingArray ) ;
1929
20- expect ( method ) . to . be . eql ( requestProps . method ) ;
2130 expect ( path ) . to . be . eql ( requestProps . path ) ;
31+ expect ( method ) . to . be . eql ( requestProps . method ) ;
32+ expect ( pathUsingArray ) . to . be . eql ( requestPropsUsingArray . path ) ;
33+ expect ( methodUsingArray ) . to . be . eql ( requestPropsUsingArray . method ) ;
2234 } ) ;
2335
2436 it ( 'should set request method on GET by default' , ( ) => {
2537 class Test {
2638 @RequestMapping ( { path : '' } )
27- public static test ( ) { }
39+ public static test ( ) { }
2840 }
2941
3042 const method = Reflect . getMetadata ( 'method' , Test . test ) ;
43+
3144 expect ( method ) . to . be . eql ( RequestMethod . GET ) ;
3245 } ) ;
3346
3447 it ( 'should set path on "/" by default' , ( ) => {
3548 class Test {
3649 @RequestMapping ( { } )
37- public static test ( ) { }
50+ public static test ( ) { }
51+
52+ @RequestMapping ( { path : [ ] } )
53+ public static testUsingArray ( ) { }
3854 }
3955
40- const method = Reflect . getMetadata ( 'path' , Test . test ) ;
41- expect ( method ) . to . be . eql ( '/' ) ;
56+ const path = Reflect . getMetadata ( 'path' , Test . test ) ;
57+ const pathUsingArray = Reflect . getMetadata ( 'path' , Test . testUsingArray ) ;
58+
59+ expect ( path ) . to . be . eql ( '/' ) ;
60+ expect ( pathUsingArray ) . to . be . eql ( '/' ) ;
4261 } ) ;
4362} ) ;
0 commit comments