| 9 | import { initializeTests } from './init'; |
| 10 | |
| 11 | @Controller('/test') |
| 12 | class TestController extends ApiController { |
| 13 | |
| 14 | @HttpGet('/:id') |
| 15 | get(id: string): any { |
| 16 | return { data: id }; |
| 17 | } |
| 18 | |
| 19 | @HttpGet('/:user/images/:img') |
| 20 | getImg(img: string, user: string): any { |
| 21 | return { img: img, user: user }; |
| 22 | } |
| 23 | |
| 24 | @HttpPost('/post') |
| 25 | post(body: any): any { |
| 26 | return body; |
| 27 | } |
| 28 | |
| 29 | @HttpPost('/add/:id') |
| 30 | add(body: any, id: string): any { |
| 31 | return { body: body, id: id }; |
| 32 | } |
| 33 | |
| 34 | @HttpGet('/optional/:id?') |
| 35 | optional(id: string): any { |
| 36 | // reason to return "undefined" |
| 37 | // because json stringify will remove elements |
| 38 | // which are undefined |
| 39 | if (id === undefined) return { data: 'undefined' }; |
| 40 | |
| 41 | return { data: id }; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | describe('segments.e2e.spec', () => { |
| 46 | const baseRoute = '/api/test'; |
nothing calls this directly
no test coverage detected