11import 'reflect-metadata' ;
22import { expect } from 'chai' ;
33import { RequestMethod } from '../../enums/request-method.enum' ;
4- import { Get , Post , Delete , All , Put } from '../../index' ;
4+ import { Get , Post , Delete , All , Put , Patch } from '../../index' ;
55
66describe ( '@Get' , ( ) => {
77 const requestPath = 'test' ;
@@ -156,4 +156,35 @@ describe('@Put', () => {
156156 expect ( path ) . to . be . eql ( '/' ) ;
157157 } ) ;
158158
159+ } ) ;
160+
161+ describe ( '@Patch' , ( ) => {
162+ const requestPath = 'test' ;
163+ const requestProps = {
164+ path : requestPath ,
165+ method : RequestMethod . PATCH ,
166+ } ;
167+
168+ it ( 'should enhance class with expected request metadata' , ( ) => {
169+ class Test {
170+ @Patch ( requestPath )
171+ public static test ( ) { }
172+ }
173+
174+ const path = Reflect . getMetadata ( 'path' , Test . test ) ;
175+ const method = Reflect . getMetadata ( 'method' , Test . test ) ;
176+
177+ expect ( method ) . to . be . eql ( requestProps . method ) ;
178+ expect ( path ) . to . be . eql ( requestPath ) ;
179+ } ) ;
180+
181+ it ( 'should set path on "/" by default' , ( ) => {
182+ class Test {
183+ @Patch ( )
184+ public static test ( ) { }
185+ }
186+ const path = Reflect . getMetadata ( 'path' , Test . test ) ;
187+ expect ( path ) . to . be . eql ( '/' ) ;
188+ } ) ;
189+
159190} ) ;
0 commit comments